tailieunhanh - JavaScript Bible, Gold Edition part 203

JavaScript Bible, Gold Edition part 203. This book will bring programmers and non-technical professionals, including casual programmers and scripters, painlessly up to speed on all aspects of mastering JavaScript. Key topics include programming fundamentals, JavaScript language elements and how to use them effectively, and how to easily and efficiently add powerful new functionality to HTML documents and Java applets. | CD-512 Part VI Appendixes OPTION Element Object Properties label NN2 NN3 NN4 NN6 IE3 J1 IE3 J2 IE4 IE5 Compatibility Example The following statement modifies the text that appears as the selected text in a popup list 0 . 3 .label Widget 9000 If this option is the currently selected one the text on the pop-up list at rest changes to the new label. OPTGROUP Element Object Properties label NN2 NN3 NN4 NN6 IE3 J1 IE3 J2 IE4 IE5 Compatibility Example I present Listing 26-9 in the hope that Microsoft and Netscape will eventually eradicate the bugs that afflict their current implementations of the label property. When the feature works as intended Listing 26-9 demonstrates how a script can alter the text of option group labels. This page is an enhanced version of the background color setters used in other examples of this chapter. Be aware that Appendix F Examples from Parts III and IV CD-513 IE5 Mac does not alter the last OPTGROUP element s label and NN6 achieves only a partial change to the text displayed in the SELECT element. Listing 26-9 Modifying OPTGROUP Element Labels HTML HEAD TITLE Color Changer 3 TITLE SCRIPT LANGUAGE JavaScript var regularLabels Reds Greens Blues var naturalLabels Apples Leaves Sea function setRegularLabels list var optGrps OPTGROUP for var i 0 i i optGrps i .label regularLabels i function setNaturalLabels list var optGrps OPTGROUP for var i 0 i i optGrps i .label naturalLabels i function seeColor list var newColor .value if newColor newColor SCRIPT HEAD BODY onUnload 0 .reset FORM P Choose a background color SELECT name colorsList onChange seeColor this OPTGROUP ID optGrp1 label Reds OPTION value ff9999 Light Red OPTION value ff3366 Medium Red OPTION value ff0000 Bright Red OPTION value 660000 Dark Red OPTGROUP OPTGROUP ID optGrp2 label .

TỪ KHÓA LIÊN QUAN