|
<Script language=JavaScript> <!-- Urls = new Array("fld/0.gif","fld/1.gif","fld/2.gif","fld/3.gif", "fld/4.gif","fld/5.gif","fld/6.gif","fld/7.gif","fld/8.gif","fld/9.gif","fld/10.gif") P = 0 Counter = Urls.length - 1 function Previous() { if (P == 0) {document.Sliding.src=Urls[9];P=10} if (P > 0){/*Here P ( 10.gif doesn't exist ) is = 10 */P--; document.Sliding.src=Urls[P/* Here P is = 9 */]}} function Next() { if (P < Counter) {P++;document.Sliding.src=Urls[P] if (P == 10) {document.Sliding.src=Urls[0];P=0} }} //--> </Script> |
The last Url fld/10.gif does not fisically exist in the folder " fld " , of this image exists the array position only, useful to load 9.gif if the Visitor clicks on Previous while he is looking at 0.gif This trick is also necessary to restart to slide images forwards from 0.gif if the image shown is 9.gif and the Visitor is using Next function. <img src="fld/0.gif" name="Sliding" alt="Slideshow"> <a href="javascript:Previous()">Previous</a> <a href="javascript:Next()">Next</a> |