The values in the select drop-down box are divided into two situations: option without value attribute and value Attribute. The specific implementation code is given below, for more information about how to obtain the select drop-down box value, see:
1. When the option in the drop-down box does not have the value Attribute
The Code is as follows:
Student ID Name AgeScript window. onload = funciton () {var param = document. getElementById ("param1"); param. onchange = getParam () {var text = param. value;} script 2. when the option in the drop-down box has the value attribute, the Code is as follows:
Student ID
Name
Age
Script
Window. onload = funciton (){
Var param = document. getElementById ("param1 ");
Param. onchange = getParam (){
Var selectIndex = param. selectIndex; // obtain the cited number of the selected option
Var text = param. options [selectIndex]. text;
Script