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');
});
});
精彩评论