<html>
<head>
</head>
<body>
<script language="javascript">
<!--
var subcat = new Array();
subcat[0] = new Array('10','1','=1')
subcat[1] = new Array('10','2','=2')
subcat[2] = new Array('10','3','=3')
subcat[3] = new Array('10','4','=4')
subcat[4] = new Array('10','5','=5')
subcat[5] = new Array('10','6','=6')
subcat[6] = new Array('10','7','=7')
subcat[7] = new Array('10','8','=8')
subcat[8] = new Array('10','9','=9')
subcat[9] = new Array('10','10','=10')
subcat[10] = new Array('20','11','=11')
subcat[11] = new Array('20','12','=12')
subcat[12] = new Array('20','13','=13')
subcat[13] = new Array('20','14','=14')
subcat[14] = new Array('20','15','=15')
subcat[15] = new Array('20','16','=16')
subcat[16] = new Array('20','17','=17')
subcat[17] = new Array('20','18','=18')
subcat[18] = new Array('20','19','=19')
subcat[19] = new Array('20','20','=20')
function changeselect1(locationid)
{
document.form1.s2.length = 0; //初始化下拉列表 清空下拉数据
document.form1.s2.options[0] = new Option('==请选择==',''); //给第一个值
for (i=0; i<subcat.length; i++) //legth=20
{
if (subcat[i][0] == locationid) //[0] [1] 第一列 第二列
{document.form1.s2.options[document.form1.s2.length] = new Option(subcat[i][1], subcat[i][2]);} //建立option
//第一次 length=1 因为有==请选择==
//i=9时 length= 10 值有11个 因为从0数起 subcat[i][0] == locationid屏蔽了再写
}
}
//-->
</script>
<form name="form1">
二级联动:
<select name="s1" onChange="changeselect1(this.value)">
<option>==请选择==</option>
<option value="10">1-10</option>
<option value="20">11-20</option>
</select>
<select name="s2" onChange="alert(this.value)">
<option>==请选择==</option>
</select>
</form>