开发者

Javascript/jquery iframe next/previous navigation

I have like a hundred of html files with names 开发者_开发百科2.html, 4.html, 6.html, 8.html etc. and i want to make simple "next/prev" navigation with iframe. If user press "next" - html in iframe changes from 2.html to 4.html. Press "prev" - from 4 to 2.

Already tried this solution with increments 2 and -2, but it's not work.


var page = 2;
$(document).ready(function () {
    $('#next').click(function(){
        page += 2;
        $('iframe').attr('src', './'+page+'.html');
    });
    $('#previous').click(function(){
        page -= 2;
        $('iframe').attr('src', './'+page+'.html');
    });
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜