In general, the default values in the drop-down box are the first. For example, the default value of the code below must be "red ":
<SELECT>
<Option value = "red"> Red </option>
<Option value = "green"> green </option>
<Option value = "blue"> blue </option>
</SELECT>
So what should we do if we want to customize the default value of option? In fact, JavaScript is easy to implement. For example, it can be implemented based on the option value:
<SELECT>
<Option value = "red"> Red </option>
<Option value = "green"> green </option>
<Option value = "blue"> blue </option>
</SELECT>
<SCRIPT>
Document. getelementsbytagname_r ("select") [0]. value = "green ";
</SCRIPT>
For example, it is implemented according to the order of Option values (of course, the former is better ):
<SELECT>
<Option value = "red"> Red </option>
<Option value = "green"> green </option>
<Option value = "blue"> blue </option>
</SELECT>
<SCRIPT>
Document. getelementsbytagname_r ("option") (1). Selected = true
</SCRIPT>
JS cannot modify the Java variables that have been read by JSP. You can convert the Java variables into JS variables before modifying the JS variables. The JS variables will be used later: vaR id = "<% = ID %> ";