שאלה בJS

svoivandim

New member
שאלה בJS

האם מותר לכתוב כך:
<HTML> <HEAD> <TITLE></TITLE> <SCRIPT LANGUAGE=javascript> <!-- myPic2=new Array("images/kis1.jpg","images/kis2.jpg","images/kis3.jpg","images/kis4.jpg") thisPic=0 thisPic2=0 imglen=myPic.length-1 //godel hamaarah imglen2=myPic2.length-1 //godel hamaarah function chgSlide(direction,NextPrew){ if(NextPrew==0){ if(document.images){ thisPic=thisPic+direction if(thisPic>imglen){ thisPic=0 } if(thisPic<0){ thisPic=imglen } document.myPicture.src=myPic[thisPic] } } } //--> </SCRIPT> </HEAD> <BODY> <img src="images/vad1.jpg" name="myPicture" width="201" height="155" alt="Slideshow"></p> <h3> <a href="javascript:chgSlide(-1,thisPic)"><< Next </a> <a href="javascript:chgSlide(-1,thisPic)">Back >></a> </h3> </BODY> </HTML>​
גלומר אם יצרתי משתנה בתוך <HEAD>,בJS,כמו אצלי בגוגמא: thisPic=0 ואז לשלוח אותו מתוך קטע הBODY כמו אצלי בגוגמא: <a href="javascript:chgSlide(-1,thisPic)"> האם thisPic שולח 0 כמו שהתכוונתי או שזה שגוי? תודה מראש.
 
למעלה