<html> <head> <title>List</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"><script language = "JavaScript"> var onecount; onecount=0; subcat = new Array();
subcat[0] = new Array("人民币","业务甲","支行甲","网点甲","帐号甲");//将数据库中的内容存入数组
subcat[1] = new Array("人民币","业务乙","支行乙","网点乙","帐号乙");//将数据库中的内容存入数组
subcat[2] = new Array("人民币","业务乙","支行乙","网点丙","帐号丙");//将数据库中的内容存入数组
subcat[3] = new Array("人民币","业务甲","支行甲","网点甲","帐号丁");//将数据库中的内容存入数组
onecount=4;function changelocation(bz,locationid,zh)//改变下拉框的内容 { document.myform.smalllocation.length = 0; var bz=bz; var locationid=locationid; var zh=zh; var i; document.myform.smalllocation.options[0] = new Option('====请选择===='); for (i=0;i < onecount; i++) { if (subcat[i][0] == bz && subcat[i][1]==locationid && subcat[i][2]==zh) { document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i][3]); } }
} function changelocation1(bz,locationid,zh,wd)//改变下拉框的内容 { document.myform.smalllocation1.length = 0; var bz=bz; var locationid=locationid; var zh=zh; var wd=wd; var i; document.myform.smalllocation1.options[0] = new Option('====请选择===='); for (i=0;i < onecount; i++) {
if (subcat[i][0] == bz && subcat[i][1]==locationid && subcat[i][2]==zh && subcat[i][3]==wd) { document.myform.smalllocation1.options[document.myform.smalllocation1.length] = new Option(subcat[i][4]); } }
<head>
<title>List</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
subcat[0] = new Array("人民币","业务甲","支行甲","网点甲","帐号甲");//将数据库中的内容存入数组
subcat[1] = new Array("人民币","业务乙","支行乙","网点乙","帐号乙");//将数据库中的内容存入数组
subcat[2] = new Array("人民币","业务乙","支行乙","网点丙","帐号丙");//将数据库中的内容存入数组
subcat[3] = new Array("人民币","业务甲","支行甲","网点甲","帐号丁");//将数据库中的内容存入数组
onecount=4;function changelocation(bz,locationid,zh)//改变下拉框的内容
{
document.myform.smalllocation.length = 0;
var bz=bz;
var locationid=locationid;
var zh=zh;
var i;
document.myform.smalllocation.options[0] = new Option('====请选择====');
for (i=0;i < onecount; i++)
{
if (subcat[i][0] == bz && subcat[i][1]==locationid && subcat[i][2]==zh)
{
document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i][3]);
}
}
}
function changelocation1(bz,locationid,zh,wd)//改变下拉框的内容
{
document.myform.smalllocation1.length = 0;
var bz=bz;
var locationid=locationid;
var zh=zh;
var wd=wd;
var i;
document.myform.smalllocation1.options[0] = new Option('====请选择====');
for (i=0;i < onecount; i++)
{
if (subcat[i][0] == bz && subcat[i][1]==locationid && subcat[i][2]==zh && subcat[i][3]==wd)
{
document.myform.smalllocation1.options[document.myform.smalllocation1.length] = new Option(subcat[i][4]);
}
}
}
</script>
</head>
<body>
<form name="myform" method="post">
<select name="biglocation" onChange="changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value,document.myform.biglocation1.options[document.myform.biglocation1.selectedIndex].value,document.myform.biglocation2.options[document.myform.biglocation2.selectedIndex].value)">
<option value="人民币">人民币</option>
</select> <select name="biglocation1" onChange="changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value,document.myform.biglocation1.options[document.myform.biglocation1.selectedIndex].value,document.myform.biglocation2.options[document.myform.biglocation2.selectedIndex].value)">
<option value="业务甲">业务甲</option>
<option value="业务乙">业务乙</option>
</select>
<select name="biglocation2" onChange="changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value,document.myform.biglocation1.options[document.myform.biglocation1.selectedIndex].value,document.myform.biglocation2.options[document.myform.biglocation2.selectedIndex].value)">
<option value="支行甲">支行甲</option>
<option value="支行乙">支行乙</option>
</select>
<select name="smalllocation" onChange="changelocation1(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value,document.myform.biglocation1.options[document.myform.biglocation1.selectedIndex].value,document.myform.biglocation2.options[document.myform.biglocation2.selectedIndex].value,document.myform.smalllocation.options[document.myform.smalllocation.selectedIndex].value)">
<option selected value="">==所有关系==</option>
</select>
<select name="smalllocation1">
<option selected value="">==所有关系==</option>
</select>
</form>
</body>
</html>
上面就是我生成的HTML代码
{
document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i][3],subcat[i][3]);
}