Passing the values in the two boxes has good results.
Copy codeThe Code is as follows:
<Script type = "text/javascript" defer = "defer">
Function $ (value)
{
Return document. getElementById (value );
}
Function ch (s ){
Var p = new Array (0, 1, 2 );
P [0] = '';
P [1] = 'high school ';
P [2] = 'Junior high school ';
If (s. value = '0 '){
$('N2 '). options. length = 0;
$('N2 '). options. add (new Option (p [0], p [0]);
}
If (s. value = '1 '){
$('N2 '). options. length = 0;
$('N2 '). options. add (new Option (p [1], p [1]);
}
If (s. value = '2 '){
$('N2 '). options. length = 0;
$('N2 '). options. add (new Option (p [2], p [2]);
}
}
</Script>
<Table width = "400" border = "0" align = "center" cellpadding = "0" cellspacing = "0">
<Tr>
<Td width = "119"> <select name = "n1" size = "10" id = "n1" onchange = "ch (this)">
<Option value = "0"> university </option>
<Option value = "1"> high school </option>
<Option value = "2"> Junior High School </option>
</Select>
</Td>
<Td width = "281"> <select name = "n2" size = "10" id = "n2"> <option value = "a"> a </option>
</Select> </td>
</Tr>
</Table>
<Table width = "400" border = "0" align = "center" cellpadding = "0" cellspacing = "0"> <tr> <td width = "119"> <select name = "n1" size = "10" id = "n1" onchange = "ch (this) "> <option value =" 0 "> university </option> <option value =" 1 "> high school </option> <option value =" 2 "> Junior High School </option> </select> </td> <td width = "281"> <select name = "n2" size = "10" id = "n2"> <option value =" a "> a </option> </select> </td> </tr> </table>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]