Javascript-форум (https://javascript.ru/forum/)
-   Учебные материалы (https://javascript.ru/forum/study/)
-   -   Переделка скрипта (https://javascript.ru/forum/study/61292-peredelka-skripta.html)

never3d22 11.02.2016 22:10

Переделка скрипта
 
Здравствуйте подскажите где ошибка
$(function(){
    if(location.href[location.href.length - 1] == "/")
    {
        var locs = location.href.substring(0, location.href.length - 1);
        var $year = decodeURIComponent(locs).slice(1).split('/');
    }
    else
        var $year = decodeURIComponent(location.href).slice(1).split('/');
    $year = eval(Number($year[$year.length - 1]) + 1);
    $("#id").attr("href", "http://site.com/" + $year).text($year);
    $year1 = eval(Number($year]) - 2);
    $("#id1").attr("href", "http://site.com/" + $year1).text($year1);
});

И как применить к ссылке style?

never3d22 11.02.2016 23:45

Как добавить к переменной свой текст?


Часовой пояс GMT +3, время: 15:02.