15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

342<br />

LABEL.htmlFor<br />

<strong>JavaScript</strong> <strong>Examples</strong> <strong>Bible</strong>: The Essential Companion to <strong>JavaScript</strong> <strong>Bible</strong><br />

Listing 23-4 (continued)<br />

Enter your first name:<br />

Enter your last name:<br />

Enter your address:<br />

Enter your city:<br />

Male<br />

Female <br />

I am retired<br />

<br />

<br />

<br />

<br />

<br />

onSubmit<br />

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

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

Example<br />

See Listing 23-4 for an example of trapping a submission via the onSubmit event<br />

handler.<br />

LABEL Element Object<br />

Property<br />

htmlFor<br />

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

Compatibility ✓ ✓ ✓ ✓<br />

Example<br />

The following statement uses W3C DOM-compatible syntax (IE5+ and NN6) to<br />

assign a form control reference to the htmlFor property of a label:<br />

document.getElementById(“myLabel”).htmlFor = document.getElementById(“myField”)<br />

✦ ✦ ✦

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

Saved successfully!

Ooh no, something went wrong!