有两个下拉菜单,前面一个是省份,后面的那个是城市,
当选中前那个下拉菜单中的省份时,后面那个下拉菜单中的城市就跟这变化,比如说,当选中的是河南的省的时间,后面的那个下拉菜单中的城市就自动边成河南省中的全部城市拉
谁能给我说说这个是怎么实现的吗
小弟谢谢拉
<form name="form1" id="form1">
<table width="100%" border="0" cellpadding="1" cellspacing="1" class="table1">
<tr>
<td height="30" bgcolor="#E9F0FA"><div align="center">产品检索</div></td>
</tr>
<tr>
<td height="30"><SELECT onchange=listcities(this.form) name="data21">
<OPTION value="1" selected>所有分类</OPTION>
<OPTION value="11">3M工业胶带胶水</OPTION>
<OPTION value="12">3M砂纸</OPTION>
<OPTION value="13">汉高乐泰</OPTION>
</SELECT></td>
</tr>
<tr>
<td height="30"><select name="data25">
<option value="1" selected>所有分类</option>
</select></td>
</tr>
<tr>
<td height="30"><input name="name1" type="text" class="input1" id="name1" size="30"></td>
</tr>
<tr>
<td height="30"><font onClick="document.form1.submit()"><img src="images/search.gif" width="65" height="19" class="hand"></font></td>
</tr>
</table>
</form>
<script language="JavaScript">
function showSelect()
{
alert(document.form1.data21.value);
alert(document.form1.data25.value);
}
//通用JS函数
var prov11,prov12,prov13;
var code11,code12,code13;
code11 = "单面胶带,双面胶带,结构胶,快干胶,密封胶,热固胶,热熔胶,丝印胶,喷胶";
prov11 = "单面胶带,双面胶带,结构胶,快干胶,密封胶,热固胶,热熔胶,丝印胶,喷胶";
code12 = "超精细研磨,涂附研磨,不织布研磨";
prov12 = "超精细研磨,涂附研磨,不织布研磨";
code13 = "导电胶,瞬干胶,维修棒,光固化胶,螺纹锁固剂,摩帝可焊锡膏";
prov13 = "导电胶,瞬干胶,维修棒,光固化胶,螺纹锁固剂,摩帝可焊锡膏";
function subList(Num)
{
document.form1.data25.options[0].value = "";
document.form1.data25.options[0].text = "所有分类";
if (Num <= 1)
{
document.form1.data25.options.length = 1;
}
else
{
var citylist = eval("prov" + Num + ".split(',')");
var codelist = eval("code" + Num + ".split(',')");
document.form1.data25.options.length = citylist.length + 1;
for(var i=1; i<citylist.length+1; i++)
{
document.form1.data25.options[i].value = codelist[i-1];
document.form1.data25.options[i].text = citylist[i-1];
}
}
}
function listcities(form)
{
var provcode = form.data21.options[form.data21.selectedIndex].value;
subList(provcode);
return false;
}
</script>