Thursday, May 28, 2009

Stop CRM Form Save

It's little tricky here. We can either use
event.returnValue = false; or
return false;

Now the curiosity arises. What's the difference? Click on the links below.

Code : alert('You clicked C Drive.'); event.returnValue=false;
Code : event.returnValue=false; alert('You clicked Drive C.');

Observe the above two code and their behaviour when you click the links. When you click on C Drive, you receive an alert box and then the function returns false whereas when you click Drive C the function returns false and still displays the alert.

Now try clicking on the below links

Code : alert('You clicked C Drive.'); return false;
Code : return false; alert('You clicked Drive C.');

Observe the behaviour. When you click on C Drive, you receive an alert box and then function returns false whereas when you click Drive C the function returns false. [it really does]

You got the catch!!

0 comments:

Post a Comment

Video Bar

Loading...