W3C home > Mailing lists > Public > www-html@w3.org > November 2004

Re: Question about which is the correct style of JavaScript to pass to FORM's onSubmit attribute

From: Asbjørn Ulsberg <asbjorn@tigerstaden.no>
Date: Mon, 15 Nov 2004 21:20:03 +0100
To: "Sean Dockery" <sdockery@securac.net>
Cc: "HTML List" <www-html@w3.org>
Message-ID: <opshiv3puouvpchu@quark>

On Fri, 12 Nov 2004 21:34:55 +0000, Sean Dockery <sdockery@securac.net>  
wrote:

> Which is the following is correct?
>
> a) <form ... onSubmit="return checkData()">
> b) <form ... onSubmit="return checkData();">
> c) <form ... onSubmit="checkData()">
> d) <form ... onSubmit="checkData();">

Either (a) or (b). The semicolon is just a statement terminator and can be  
used to separate several function calls within one single event, if you'd  
like. Hence is the semicolon optional, but not «wrong» to have there  
either.

Neither (c) or (d) should work, imho.

> Does anyone know which is correct?

I don't have any exact knowledge on the matter, but it makes the most  
sence that the value from 'checkData()' is returned to the bubbling event.  
If you don't return it, it should imho act as a 'void'.

-- 
Asbjørn Ulsberg     -=|=-    http://virtuelvis.com/quark/
«He's a loathsome offensive brute, yet I can't look away»
Received on Monday, 15 November 2004 20:18:55 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:16:01 GMT