Click to See Complete Forum and Search --> : this function gives error - why?


gebezis
04-17-2005, 12:24 PM
I have this function:

function quiz(f){

if(f==1){
if(e==1 && val1==false){
MM_swapImage(\'result\',\'\',\'media/res1.gif\',1);
e++;
val1=true;
}
else if(e==2 && val1==false){
MM_swapImage(\'result\',\'\',\'media/res2.gif\',1);
e++;
val1=true;
}
}

vars declared before the function and it is started by the onClick function of buttons.

The page gives error masage : Object expected
What is my mistake?

P.S. There is an image field named "result" and the function MM_swapImage works itself, so the error must be somewhere outside it.

Fang
04-17-2005, 12:31 PM
Missmatch of brackets

Ultimater
04-17-2005, 02:25 PM
Missmatch of brackets

I don't see any brackets Fang!
What Fang means is that you forgot to end your function with a Right Curley Bracket. i.e. }

Also the error is because a lack of quotes.

MM_swapImage("\'result\',\'\',\'media/res1.gif\'",1);


But I'm not sure how many arguments you are supposed to send that function...
Also give the following a shot:
MM_swapImage('result','','media/res1.gif',1);

And the same goes for your other function call.