jsp页面的2级联动菜单,内容是从后台数据库里查出来的。
想要用脚本来实现菜单的联动,希望大家能给个简单实用的脚本外加说明!!!
谢谢
想要用脚本来实现菜单的联动,希望大家能给个简单实用的脚本外加说明!!!
谢谢
解决方案 »
- 怎样遍历JAR文件中的一个文件夹?
- 请大家帮个忙?想问个简单的问题
- classpath怎么设置呀?请大家踊跃的提出解决方案,多谢!
- 几个JAVA基础的小问题,看看你理解如何,另外请教,当String A ="abc"; String B="abc" A 和 B是指向同一块内存吗?
- 【UNIX】【中软同和】【SCOUNIX培训录像】
- jdbtable如何打印???在线
- 如何产生所有的数字序列。
- 我想学习JAVA,谁能推荐我一本好的入门教材?
- applet不能正常运行的问题,有请各位大侠。
- 程序运行到一半报错,An unexpected error has been detected by Java Runtime Environment:
- 一道面试题
- 控制子窗口打开的位置?
var subindusid=new Array(""
<logic:present name="subindus"> //subindus是个list的第二级数据
<logic:iterate id="sindus" name="subindus">
,"<bean:write name="sindus" property="industryId"/>" // id
</logic:iterate>
</logic:present>
);
var subindusna=new Array(""
<logic:present name="subindus">
<logic:iterate id="sindus" name="subindus">
,"<bean:write name="sindus" property="industryName"/>" // name
</logic:iterate>
</logic:present>
);
function onsel(){
var mainid=""+myform.mainindustry.value;
var psel=myform.subindustry.options;
for(i=psel.length-1;i>0;i--){
myform.subindustry.remove(i);
}
if(mainid=='0')
return;
for(j=1;j<subindusid.length;j++){
var tl=subindusid[j].length-2;
var tst=subindusid[j].substring(0,tl);
if(tst==mainid){
opt=document.createElement ("OPTION");
opt.value=subindusid[j];
opt.text=subindusna[j];
myform.subindustry.add(opt); }
}
}
</script> <tr>
<td> 主行业: </td>
<td>
<select name="mainindustry" onchange="onsel();">
<option value="0" selected><bean:message key="mainindustry.default"/></option>
<logic:present name="allmainindus">
<logic:iterate id="indus" name="allmainindus">
<option value="<bean:write name="indus" property="industryId"/>"><bean:write name="indus" property="industryName"/></option>
</logic:iterate>
</logic:present>
</select>
</td>
</tr>
<tr>
<td> 二级行业 </td>
<td>
<select name="subindustry">
<option value="0" selected><bean:message key="subindustry.default"/></option>
</select>
</td>
</tr>
有些地方不太理解,能把你QQ给我吗?
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.category.value;
var psel=myform.type.options;
for(i=psel.length-1;i>0;i--){
myform.type.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");
opt.value=id[j];
opt.text=title[j];
myform.type.add(opt); }
}
}
</script>
</head><body>
<form method="POST" name="myform">
<table>
<tr>
<td>
主行业:
</td>
<td>
<select name="category" onchange="onsel();">
<option value="0" selected>
1111
</option>
<logic:notEmpty name="category">
<logic:iterate id="ca" name="category">
<option value="<bean:write name="ca" property="personalCategoryId"/>">
<bean:write name="ca" property="personalCategoryTitle" />
</option>
</logic:iterate>
</logic:notEmpty>
</select>
</td>
</tr>
<tr>
<td>
二级行业
</td>
<td>
<select name="type">
<option value="0" selected>
2222
</option>
</select>
</td>
</tr>
</table>
</form>
</body>不灵啊,那里不对劲呢??