一个用脚本实现联动下拉列表的问题
我的代码如下,使用起来第二级菜单并不跟着动,请大家帮忙修改:
var id=new Array( " "
<logic:notEmpty name= "type "> //type是个list的第二级数据
<logic:iterate id= "ty " name= "type ">
, " <bean:write name= "ty " property= "personaltypeCategoryId "/> " // id
</logic:iterate>
</logic:notEmpty>
);
var title=new Array( " "
<logic:notEmpty name= "type ">
<logic:iterate id= "ty " name= "type ">
, " <bean:write name= "ty " property= "personaltypeTitle "/> " // title
</logic:iterate>
</logic:notEmpty>
);
function onsel(){
var mainid= " "+myform.personalCategoryId.value;
var psel=myform.personaltypeId.options;
for(i=psel.length-1;i> 0;i--){
myform.personaltypeId.remove(i);
}
if(mainid== '0 ')
return;
for(j=1;j <id.length;j++){
var tl=id[j].length-2;
var tst=id[j].substring(0,tl);
if(tst==mainid){
opt=document.createElement ( "option ");
&nbs