CD-489Appendix F . Examples from Parts III and (Apache web server)
Friday, February 15th, 2008CD-489Appendix F . Examples from Parts III and IV defaultChecked NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility Example In the script fragment of Listing 24-7 (not among the CD-ROM files), a function is passed a reference to a form containing the Stooges radio buttons. The goal is to see, in as general a way as possible (supplying the radio group name where needed), if the user changed the default setting. Looping through each of the radio buttons, you look for the one whose CHECKED attribute is set in the definition. With that index value (i) in hand, you then look to see if that entry is still checked. If not (notice the ! negation operator), you display an alert dialog box about the change. Listing 24-7: Has a Radio Button Changed? function groupChanged(form) { for (var i = 0; i < form.stooges.length; i++) { if (form.stooges[i].defaultChecked) { if (!form.stooges[i].checked) { alert( This radio group has been changed. ) } } } } length NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility Example See the loop construction within the function of Listing 24-7 for one way to apply the length property. document.formObject.radioObject.length
In case you need quality webspace to host and run your web applications, try our personal web hosting services.