View Single Post
  #2 (permalink)  
Old December 18th, 2008, 04:40 PM
Old Pedant Old Pedant is offline
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

You are missing a space between return and false so you are always getting a JavaScript error
and since apparently you don't have JavaScript debugging turned on you can't see that error.
The result is that the JavaScript code is effectively ignored.

You also do *NOT* do
return true;
when the confirm is true or the confirm is not invoked, so you can't even predict what will happen.
Yes, generally if you omit a return value from a JS function the result is the same as if you
returned true, but you can *NOT* guarantee that. If the function should return a value,
make sure that it ALWAYS does so, no matter what.

Your code should end with
Code:
    return true;
}

Last edited by Old Pedant; December 18th, 2008 at 04:43 PM..
Reply With Quote