Determining the Value or Text of the Selected Option : List : Form Control JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Form Control » List »

 

Determining the Value or Text of the Selected Option




<html>
<head>
<script language = "JavaScript">
     function getSelectValue(selectObject) {
          return selectObject.options[selectObject.selectedIndex].value
     }
   
</script>
</head>
<body>
    <form name="form1">
    Songs: 
    <select NAME="songs" SIZE=1>
        <option VALUE="AA">AA</option>
        <option VALUE="BB">BB</option>
        <option VALUE="CC">CC</option>
        <option VALUE="DD">DD</option>
        <option VALUE="EE">EE</option>
        <option VALUE="FF">FF</option>
    </SELECT><p>
    <input type=button value="Show Current" onClick="alert(getSelectValue(this.form.songs))">
</form>
</body>
</html>
           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Form Control
» List