CD-505Appendix F . Examples from Parts III (Medical web site) and

CD-505Appendix F . Examples from Parts III and IV options[index].index NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility Example The following statement assigns the index integer of the first option of a SELECT element named listName to a variable named itemIndex. var itemIndex = document.forms[0].listName.options[0].index options[index].selected NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility Example To accumulate a list of all items selected by the user, the seeList()function in Listing 26-4 systematically examines the options[index].selected property of each item in the list. The text of each item whose selected property is true is appended to the list. I add the n inline carriage returns and spaces to make the list in the alert dialog box look nice and indented. If you assign other values to the VALUE attributes of each option, the script can extract the options[index].value property to collect those values instead. Listing 26-4: Cycling through a Multiple-Selection List Accessories List