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>  

> 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  

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 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:06:09 UTC