11.12.2012 Views

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Table 11-5: Events That Can Be Invoked Directly on (X)HTML Elements<br />

Event Method Elements<br />

submit() <br />

reset() <br />

type="file">, <br />

One major pitfall when invoking events directly on forms is that the submit() method does not<br />

invoke the form‘s onsubmit handler before submission. In the following example, both the<br />

alerts will be shown:<br />

<br />

<br />

<br />

type="submit" value="Submit" onclick="alert('click fired');"<br />

<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!