- From: Justin Wood (Callek) <116057@bacon.qcc.mass.edu>
- Date: Tue, 22 Mar 2005 23:14:48 -0500
- To: Rachael Hurd <Rachael.Hurd@cgi-ams.com>
- CC: www-html@w3.org
See http://www.w3.org/2001/12/DOM-Level-2-issues#i16 and the original raised issue: http://lists.w3.org/Archives/Public/www-dom/2001OctDec/0150.html ~Justin Wood (Callek) Rachael Hurd wrote: > Can someone inform me about the background of the onsubmit HTML event > and submit() JS method? Reason I ask is because I notice when the > submit method is executed in JS, the onsubmit HTML event is not > executed. The following code below was a piece of sample code I > created to test this theory (test-JSsubmit-finish.asp was just a page > that contained ‘Hello’ on it; nothing really important). > > Was this functionality created on purpose by W3C (I'm assuming the > onsubmit HTML event came before the submit() method in JS)? If so, why? > > Thank you. > > Rachael Hurd > > ------------------------------------ > > [CODE] > > <html> > > <head> > > <title>Testing Whether a Submit Event in JS runs the OnSubmit HTML > Event</title> > > <script type="text/javascript"> > > function validateParameters() > > { > > var x = document.forms.item(0).Number1.value; > > if (x != 3) > > {alert('SILLY! ' + x + ' is not equal to 3'); return false;} > > else > > {alert('The number you entered is equal to 3!'); return true;} > > } > > function checkBoxAndSubmit() > > { > > document.forms.item(0).Checkbox1.checked=true; > > document.form01.submit(); > > } > > </script> > > <body> > > <h3>Testing Whether a Submit Event in JS runs the OnSubmit HTML Event</h3> > > <br /> > > <form name="form01" id="form01" > action="/Hospital/Tests/test-JSsubmit-finish.asp" method="post" > onsubmit="return validateParameters(4);"> > > <input type="checkbox" name="Checkbox1" id="Checkbox1" > onclick="checkBoxAndSubmit();" /> > > <input type="text" name="Number1" value="Enter a Number"/> > > <input type="submit" name="SubmitButton" value="Submit"> > > </form> > > </body> > > </html> > > [/CODE] >
Received on Wednesday, 23 March 2005 04:16:15 UTC