javascript - PhoneGap - Can't Find variable -
so made simple slideshow in js display photogalery in page, problem whenever try slideshow console shows me error
referenceerror: can't find variable: next
this code:
slideshow js code:
<script> var myimage= new array(); myimage[0]="1.jpg"; myimage[1]="2.jpg"; myimage[2]="3.jpg"; myimage[3]="4.jpg"; myimage[4]="5.jpg"; myimage[5]="6.jpg"; myimage[6]="7.jpg"; myimage[7]="8.jpg"; myimage[8]="9.jpg"; myimage[9]="10.jpg"; myimage[10]="11.jpg"; myimage[11]="12.jpg"; var imagecnt = 0; function next(){ imagecnt++; document.getelementbyid("whitebox").style.background = 'url(' + myimage[imagecnt] + ')'; } function previous(){ imagecnt--; document.getelementbyid("whitebox").style.background = 'url(' + myimage[imagecnt] + ')'; } </script>
html body code:
<div data-role="content"> <div id="whitebox"></div> <a href="#" onclick="next();return false;"><img src="next.png"/></a> <a href="#" onclick="previous();return false;"><</a> </div>
i searched on internet , found many similiar situations, not find solution.
have attemped try call in console?
use google chrome press ctrl+shift+j , type in next();
or try this;
<a href="#" onclick="javascript:next();"><img src="next.png"/></a>
Comments
Post a Comment