<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body> <script language="javascript">
var shopid = new array();
shopid[0] = new array("1","江山信息")
shopid[1] = new array("2","测试店铺")
var shopclass = new array();
var countlength111 = 5;
shopclass[0] = new array("1","1","短信产品");
shopclass[1] = new array("2","1","声讯产品");
shopclass[2] = new array("3","1","电视广告");
shopclass[3] = new array("4","2","测试");
shopclass[4] = new array("5","2","测试");
function sss(locationid)
{
document.getElementById("c_id").length = 0;
var locationid=locationid;
var i;
alert(countlength111.toString());
for (i=0;i<countlength111; i++)
{ alert(shopclass[i][0]);
document.getElementById("c_id").options[i]=new Option(shopclass[i][0],shopclass[i][2]);
}
}
</script>
<table bgcolor="#ffffff" borderColor="#f0f0f0" Border="1" Cellspacing="0" Cellpadding="5" width="100%" align="Center" style="border-collapse: collapse">
<tr>
<td width="17%">选择商铺</td>
<td><select name="shopid" class="input" id="shopid" onChange="sss(this.value)">
<option value=1>江山信息</option><option value=2>测试店铺</option>
</select></td>
</tr>
<tr>
<td>产品分类</td>
<td><select name="c_id" class="input" id="c_id">
<option value=1>短信产品</option><option value=2>声讯产品</option><option value=3>电视广告</option>
</select></td>
</tr>
</table>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body> <script language="javascript">
var shopid = new array();
shopid[0] = new array("1","江山信息")
shopid[1] = new array("2","测试店铺")
var shopclass = new array();
var countlength111 = 5;
shopclass[0] = new array("1","1","短信产品");
shopclass[1] = new array("2","1","声讯产品");
shopclass[2] = new array("3","1","电视广告");
shopclass[3] = new array("4","2","测试");
shopclass[4] = new array("5","2","测试");
function sss(locationid)
{
document.getElementById("c_id").length = 0;
var locationid=locationid;
var i;
alert(countlength111.toString());
for (i=0;i<countlength111; i++)
{ alert(shopclass[i][0]);
document.getElementById("c_id").options[i]=new Option(shopclass[i][0],shopclass[i][2]);
}
}
</script>
<table bgcolor="#ffffff" borderColor="#f0f0f0" Border="1" Cellspacing="0" Cellpadding="5" width="100%" align="Center" style="border-collapse: collapse">
<tr>
<td width="17%">选择商铺</td>
<td><select name="shopid" class="input" id="shopid" onChange="sss(this.value)">
<option value=1>江山信息</option><option value=2>测试店铺</option>
</select></td>
</tr>
<tr>
<td>产品分类</td>
<td><select name="c_id" class="input" id="c_id">
<option value=1>短信产品</option><option value=2>声讯产品</option><option value=3>电视广告</option>
</select></td>
</tr>
</table>
</body>
</html>
我这里就好使了
不过 二级的select 不是汉字 而是 1,2,3,4,5
document.getElementById("c_id").options[i]=new Option(shopclass[i][0],shopclass[i][2]);
改成
document.getElementById("c_id").options[i].value=shopclass[i][0];
document.getElementById("c_id").options[i].text=shopclass[i][2]; 试一下