javascript - How to Display Page Number for iFrame Pagination -
i have main page includes iframe , pagination.
i want display page numbers of iframe pages on sidebar of main page (means, not in iframe in page contain iframe)
here image display want do:
i use jquery code (using jquery-1.9.1.js):
<script> var locations = ["./pages/0.html","./pages/1.html", "./pages/2.html", "./pages/3.html","./pages/4.html"]; var currentindex = 0; var len = locations.length; $(document).ready(function(){ $(':button').click(function() { currentindex = this.value == "next" ? currentindex < len - 1 ? ++currentindex : len - 1 : currentindex > 0 ? --currentindex : 0; $('#zoome').attr('src', locations[currentindex]); }); }); </script>
i wonder correct code display page numbers between next , previous buttons?
here live link: coreneto
you can code html
$('#iframe').load(function() { var src = $('#iframe').contents().find("html").html(); alert(src); });
you can use element's specific value. did not pagination value located assume it's in div or something.
to specific value
$('input:button[name=buttonname]').click(function() { var name = $('iframe[name=iframename]').contents().find('#controlid').val(); });
edit-------------------------------- because have provided more information, suggestion.
create counter label , place in between next , previous button.
javascript increment label amount when click next , decrease when going previous.
make save guard have min , max , forward with. prevents on being on page -1 or higher number pages navigating to.
Comments
Post a Comment