'label' Example : label « Javascript Properties « JavaScript Reference

Home
JavaScript Reference
1.Event Handlers Reference
2.Javascript Collections
3.Javascript Methods
4.Javascript Objects
5.Javascript Properties
JavaScript Reference » Javascript Properties » label 
'label' Example

<!-- 
Example revised from 

The Web Programmer's Desk Reference
by Lazaro Issi Cohen and Joseph Issi Cohen 

ISBN: 1593270119
Publisher: No Starch Press 2004
-->    
<html>
<body>
<form name="form2" method="post" action="">
<select name="select1">
<optgroup id="optg1"
    <option id="opt1_1">first</option>
    <option>second</option>
    <option>third</option>
</optgroup>
<optgroup id="optg2">
    <option>first item in second group </option>
    <option id="opt2_2">second item in second group </option>
    <option>third item in second group </option>
</optgroup> 
<script language="JavaScript">
    document.getElementById("optg1").label = "first group";
    document.getElementById("optg2").label = "second group";
</script>
</select>
</form>
</body>
</html>

    
      
      
Related examples in the same category
1.'label' Syntax and Note
2.'label' is applied to
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.