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

Create successful ePaper yourself

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

Yes:<br />

<br />

No:<br />

<br />

Maybe:<br />

<br />

does not, as it fails to preserve the expected ―one of many selection‖ of radio buttons.<br />

Note In the case of grouped items like radios, you may notice that the name and id values do<br />

not match up. This is a small variation in XHTML where the id for an element must be<br />

unique whereas the name value should not be. Be careful, you really do need to know<br />

your markup to take full advantage of <strong>JavaScript</strong>.<br />

Given that with radio or checkbox groups you will generally have an array of identically named<br />

items, you might have to loop through the collection in order to figure out which item was<br />

selected. A complete example showing this as well as other radio and checkbox features is<br />

presented here; its rendering appears in Figure 14-3.<br />

Figure 14-3: Checkbox/radio example under Internet Explorer<br />

<br />

<br />

<br />

radio/checkbox test<br />

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

Saved successfully!

Ooh no, something went wrong!