开发者

Javascript/jquery iframe next/previous navigation

开发者 https://www.devze.com 2023-02-23 05:49 出处:网络
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 ifram

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

精彩评论

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