Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: OnClick in the Form Submit Button


Message #1 by anne.do@c... on Mon, 9 Dec 2002 12:15:18 -0500
For some reason, whenever I try to cancel an event by returning false in 
IE 5.5+, it doesn't work.  I have to add a line like:

window.event.returnValue=false;

This is certainly the case when trying to cancel a submit button, and I 
think it's true generally to cancel IE events.

In the Microsoft Visual Studio .NET documentation, I find this statement 
relating to event.returnValue:

"The value of this property takes precedence over values returned by the 
function, such as through a ... return statement."

Since the default returnValue is true, you HAVE to set it to false in 
order to cancel an event!

> ----- Original Message -----

	Yup.
	On the other hand, in order to make sure that script-disabled
browser still works, it's necessary to keep the submit button.  So, she
could use the following line :

<input name=3D"submit" type=3D"submit" value=3D"Delete ID"
	onclick=3D"return confirm('Permanently delete the ID?')" >

  Return to Index