15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

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.

Chapter 8 ✦ Button Objects (Chapter 24)<br />

<br />

<br />

name<br />

NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5<br />

Compatibility ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓<br />

Example<br />

See the example for the form property earlier in this chapter for a practical<br />

application of the name property.<br />

value<br />

NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5<br />

Compatibility ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓<br />

Example<br />

In the following excerpt, the statement toggles the label of a button from “Play”<br />

to “Stop” (except in NN/Mac through version 4):<br />

var btn = document.forms[0].controlButton<br />

btn.value = (btn.value == “Play”) ? “Stop” : “Play”<br />

Methods<br />

click()<br />

NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5<br />

Compatibility ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓<br />

Example<br />

The following statement demonstrates how to script a click action on a button<br />

form control named sender:<br />

document.forms[0].sender.click()<br />

345<br />

document.formObject.buttonObject.click()

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

Saved successfully!

Ooh no, something went wrong!