两个关联的列表问题(~~~~急急急急急!!!!!!~~~~~)
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
subcat[0] = new Array("张","5","5");
subcat[1] = new Array("王","6","6");
subcat[2] = new Array("李","5","20");
subcat[3] = new Array("zch","5","31");
onecount=4;
function changelocation(locationid)
{
document.form1.sid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.form1.sid.options[document.form1.sid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
</head>
<form name="form1" method="post" action="">
<table width="100%" >
<tr bgcolor="#FFFFFF">
<td >
<div align="left">
<select size="1" name="bid" onChange="changelocation(document.form1.bid.options[document.form1.bid.selectedIndex].value)">
<option>选择</option>
<option value=5>张家</option>
<option value=6>王家</option>
<option value=9>胡家</option>
</select>
<select name="sid" onChange="change(document.form1.sid.options[document.form1.sid.selectedIndex].value)" style='width:147;background-color:white;font-size:12;color:black; height:18' size="1">
<option selected>z</option>
</select>
<input name="1" type="submit" value="1"></div></td>
</tr>
</table>
</form>
两个相互关联的列表,我在第一个列表选择了"张家",第二个选择"李",浏览器就提示错误
行:54
错误:缺少对象
------解决方案--------------------<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<script language = "JavaScript" >
var onecount;
onecount=0;
subcat = new Array();
subcat[0] = new Array("张","5","5");
subcat[1] = new Array("王","6","6");
subcat[2] = new Array("李","5","20");
subcat[3] = new Array("zch","5","31");
onecount=4;
function changelocation(locationid)
{
document.form1.sid.length = 0;
var locationid=locationid;
v