This is in the last unit of the BDQN project, do an OA project, interim requirements Control Select selection:
<TD align= "Left" >
<input type= "hidden" value= "${u.usersex}" id= "Sex" >
<select name= " U.usersex "width=" 30% "id=" gender ">
<option value=" Women "id=" woman "> Women </option>
<option Value = "Male" id= "man" > </option>
</select>
</td>
Here is the code in JS:
<script type= "Text/javascript" >
var sex = document.getElementById ("Sex"). Value;
if (sex = = "Man") {
document.getElementById ("Gender"). Options[1].selected=true;
} else{
document.getElementById ("Gender"). Options[0].selected=true;
}
Check userName
function CheckName () {
var name = document.getElementById ("UserName"). Value;
if (name = = NULL | | | name = = "") {
alert ("User name cannot be empty!");
return;
}
Check Usertel
function Checktel () {
var tel = document.getElementById ("Usertel"). Value;
if (tel = = NULL | | tel = = "") {
alert ("Cell phone number cannot be empty!");
return;
}
if (Tel.length!=) {
alert ("Please enter the correct 11-digit mobile number.") ");
return;
}
Returns the previous page
function Backit () {
history.back ();
}
Commit
function SaveIt ()
{
document.forms[0].submit ();
}
</script>