PDA

View Full Version : when i write this method all of JS stops working!



Binji
November 9th, 2006, 11:16 AM
Every time i add this function to my JS file everything stops working. Including alerts, rollovers...everything! Can anyone tell me what could be the problem?


function gSlike(desno, stGalerije){
if(desno){ //if the right button is pressed
curImage++;
if(curImage>12){
curImage=1;
}
}else{
curImage--;
if(curImage<1){
curImage=12;
}
}
switch('velika', 'images/velike/'+stGalerije+'_'+curImage+'.png';
}
It's supposed to be the code for left and right buttons which control displaying images on the website. The "switch" functions works because i use it also for when user clicks on the thumbnail image.

Binji
November 9th, 2006, 11:24 AM
whoops..fixed it..argument for switch function wasnt really cleverly written :D

senocular
November 9th, 2006, 11:39 AM
and by that you mean switch is a reserved keyword that shouldn't be used as a function name?

amaze
November 9th, 2006, 11:55 AM
I think he means that he forgot to close the parenthesis.

Binji
November 13th, 2006, 05:38 AM
I think he means that he forgot to close the parenthesis.
That was it:) I actually didnt use "switch" for the name...i only changed it for this forum so you would have an idea what it does