JS选择一个列表框,赋值到另一个列表框
<script >
<!--
function onselectchange(){
num=document.send.class0.options[document.send.class0.selectedIndex].value;
switch(num){
case "0":
document.send.class1.options.length=4;
document.send.class1.options[00].text="A1";
document.send.class1.options[00].value=0;
document.send.class1.options[01].text="A2";
document.send.class1.options[01].value=1;
document.send.class1.options[02].text="A3";
document.send.class1.options[02].value=2;
document.send.class1.options[03].text="A4";
document.send.class1.options[03].value=3;
break;
case "1":
document.send.class1.options.length=6;
document.send.class1.options[00].text="B1";
document.send.class1.options[00].value=0;
document.send.class1.options[01].text="B2";
document.send.class1.options[01].value=1;
document.send.class1.options[02].text="B3";
document.send.class1.options[02].value=2;
document.send.class1.options[03].text="B4";
document.send.class1.options[03].value=3;
document.send.class1.options[04].text="B5";
document.send.class1.options[04].value=4;
document.send.class1.options[05].text="B6";
break; }}
//-->
</script>
<table width="400" border="1" cellspacing="0" cellpadding="0" align="center" bordercolordark="#9cc384" bordercolorlight="#FFFFFF">
<tr bgcolor="#E6F0DD" align="center">
<td> <br>
<form method="post" action="a_list.asp" name="send" target="_blank">
<table width="62%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="44%" align="right">类别:</td>
<td width="56%">
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<select name="class0" onChange="onselectchange()">
<option value="2">** 选择一级类别 **</option>
<option value="0">A</option>
<option value="1">B</option>
</select>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<select name="class1">
<option value="1">** 选择二级类别 **</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<br>
<br>
</td>
</tr>
</table>
浙公网安备 33010602011771号