'onChange' Example : onChange « Event Handlers Reference « JavaScript Reference

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




'onChange' Example

    
<head>
<script language="JavaScript">
    function function1(colors) {
        var col = (colors.options[colors.selectedIndex].value);
        if (col) { 
           document.bgColor = col; 
        }
        alert("The background color has changed to "+col
    
</script></head>
<body>
<select name="colors" onChange="function1(this)">
    <option value="white" selected>White</option>
    <option value="cyan">Cyan</option>
    <option value="ivory">Ivory</option>
</select>
</body>

    
      
      














Related examples in the same category
1.'onChange' Syntax and Note
2.'onChange' Properties
3.'onChange' 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.