JavaScript slider not going to next image -


can me out here copy same code 1 page , pasted on , page ive added , button's not display next image redirects me next.html? have changed directory image in.

<table width="100%">     <tr>         <td>             <script type="text/javascript">                 window.onload = initlinks;                 // create array of pictures/strings                 var mypics = new array("includes/img/slider/1.jpg", "includes/img/colleges/1/2.jpg", "includes/img/colleges/1/3.jpg", "includes/img/colleges/1/4.jpg", "includes/img/colleges/1/5.jpg");                                   // track displayed image, set 0                 var thispic = 0;                                   // handle behaviors when next , previous links clicked                 function initlinks() {                     // when prevlink clicked, call function fetch previous pic                     document.getelementbyid("prevlink").onclick = processprevious;                     // when nextlink clicked, call function fetch next pic                     document.getelementbyid("nextlink").onclick = processnext;                 }                                   // called when prevlink clicked                 function processprevious() {                     // if on slide 0                     if (thispic == 0) {                         // set thispic same value array length (meaning last picture)                         // allows looping around collection not reaching end                         thispic = mypics.length;                     }                     // decrement thispic 1 less last pic point previous                     thispic--;                     // set source of page's displayed picture new current                     document.getelementbyid("currentpicture").src = mypics[thispic];                     // js handled work, prevent next page being fetched                     return false;                 }                                   // called when nextlink clicked                 function processnext() {                     // incerement thispic 1 more last pic point next                     thispic++;                     // if on last picture in array                     if (thispic == mypics.length) {                         // set thispic original value in array (meaning first picture)                         // allows looping around collection not reaching end                         thispic = 0;                     }                     // set source of page's displayed picture new current                     document.getelementbyid("currentpicture").src = mypics[thispic];                     // js handled work, prevent next page being fetched                     return false;                 }                                                </script>             <img src="includes/img/slider/1.jpg" id="currentpicture" width="100%" height="250" alt="slideshow" />             <center>             <a href="previous.html" id="prevlink"><img src="includes\img\back.gif" alt="previous" /></a>&nbsp;&nbsp;             <a href="next.html" id="nextlink"><img src="includes\img\next.gif" alt="next" /></a>             </center>         </td>     </tr> </table> 


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -