javascript的二级联动无法调用
以下是二级联动代码,在<select id="s1" name="depa"><option></option></select>中无法调用,求高手指教!<SCRIPT LANGUAGE="JavaScript">
<!--
function Dsy()
{
this.Items = {};
}
Dsy.prototype.add = function(id,iArray)
{
this.Items[id] = iArray;
}
Dsy.prototype.Exists = function(id)
{
if(typeof(this.Items[id]) == "undefined") return false;
return true;
}
function change(v){
var str="0";
for(i=0;i<v;i++){ str+=("_"+(document.getElementById(s[i]).selectedIndex-1));};
var ss=document.getElementById(s[v]);
with(ss){
length = 0;
options[0]=new Option(opt0[v],opt0[v]);
if(v && document.getElementById(s[v-1]).selectedIndex>0 || !v)
{
if(dsy.Exists(str)){
ar = dsy.Items[str];
for(i=0;i<ar.length;i++)options[length]=new Option(ar[i],ar[i]);
if(v)options[1].selected = true;
}
0
}
if(++v<s.length){change(v);}
}
}
var dsy = new Dsy();
dsy.add("0",["生产部","工程部","质量部","工艺部","机械部"]);
dsy.add("0_0,["盘机","线退","天车","空拉","清洗","仓库"]);
dsy.add("0_1",["机修","电修","公共设施"]);
dsy.add("0_2",["实验室1","实验室2","办公室"]);
dsy.add("0_3",["技术"]);
dsy.add("0_4",["模具房","机加工"]);
//-->
</SCRIPT>
<SCRIPT language = javascript>
<!--
var s=["s1","s2"];
var opt0 = ["请选择部门","请选择组别"];
function setup()
{
for(i=0;i<s.length-1;i++)
document.getElementById(s[i]).onchange=new Function("change("+(i+1)+")");
change(0);
}
//-->
</SCRIPT>
<body onload="setup()">
调用:<select id="s1" name="depa"><option></option></select>
<select id="s2" name="gong"><option></option></select>