|
|
Forum moderator: bigblog |
uCoz Community For Webmasters Custom Solutions How to make next previous script |
How to make next previous script |
Hello, did someone know how to make next pevious javascript in Publisher and File Catalog. For example I have tv show with 12 episodes, so i need to add next and previous buttons so if users click next they will be moved on next episode, for example if users are on episode 8 and if they click next they will be on episode 9 and when they come to end of series that they can't go next anymore because category has only 12 episodes.
|
Code <div id="pages"></div> <script> a=location.href; b=a.split('-'); c=b.length; d=eval(c-1); e=b[d]; f=a.split('-'+e)[0]; $('#pages').html('<a id="b" href="'+f+'-'+eval(e-1)+'">Previous</a><span id="i"> | </span><a id="a" href="'+f+'-'+eval(e*1+1)+'">Next</a>'); $.ajax({ type: 'GET', url: f+'-'+eval(e*1+1), error: function(){$('#a, #i').hide();} }); $.ajax({ type: 'GET', url: f+'-'+eval(e-1), error: function(){$('#b, #i').hide();} }); </script> |
| |||
| |||