[J2EE]自己用html dom写的二级级联菜单(从数据库里取数据) |
<script>function createSmallClass(){ var x=document.getElementById("bigclass"); var y=document.getElementById("smallclass");
delSmallClass(y); if(x.options[x.selectedIndex].value==1) { <logic:notEmpty name="dep" scope="request"> <logic:iterate id="dep" name="dep" scope="request" > <bean:define id="depid" name="dep" property="id"/> <bean:define id="depname" name="dep" property="depname"/> y.options.add( new Option( "<%=depname%>" , "<%=depid%>" ) ); </logic:iterate> </logic:notEmpty> var id=y.options[y.selectedIndex].value; document.getElementById("ifr").src="list-log.jsp?depId="+id;
}else{ <logic:notEmpty name="pro" scope="request"> <logic:iterate id="pro" name="pro" scope="request" > <bean:define id="proid" name="pro" property="id"/> <bean:define id="proname" name="pro" property="proname"/> y.options.add( new Option( "<%=proname%>" , "<%=proid%>" ) ); </logic:iterate> </logic:notEmpty> var id=y.options[y.selectedIndex].value; document.getElementById("ifr").src="list-log.jsp?proId="+id; }}
function delSmallClass(y){ var j = y.length; for( i=0 ; i < j ; i++ ) { y.remove(y.selectedIndex); }}
function createLog(){ var x=document.getElementById("bigclass"); var y=document.getElementById("smallclass"); if(x.options[x.selectedIndex].value==1) { var depId=y.options[y.selectedIndex].value; document.getElementById("ifr").src="list-log.jsp?depId="+depId; }else if(x.options[x.selectedIndex].value==2) { var proId=y.options[y.selectedIndex].value; document.getElementById("ifr").src="list-log.jsp?proId="+proId; } }</script>
<span class="jstore-header style4"> <script language="javascript">document.write(this.document.title);</script></span><hr size="1"> <form name="form1" action=""> <select id="bigclass" onclick="createSmallClass()"> <option value="1" selected>部门</option> <option value="2">项目</option> </select> <select id="smallclass" onclick="createLog()"> </select> </form> <iframe id="ifr" src="" frameborder="0" width="600" scrolling="no" height="500"> </iframe>
感觉比较简单,没有用ajax框架,多多支持自己
|
|
回复:自己用html dom写的二级级联菜单(从数据库里取数据) |
小朋友(游客)发表评论于2007/3/28 2:33:20 | 嘻嘻...对我有用...
|
|
» 1 »
|  .: 公告
|
« | August 2025 | » | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | | | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | | | | | |
| .: 我的分类(专题) |  .: 最新日志 .: 最新回复
| 
blog名称:up forever 日志总数:130 评论数量:274 留言数量:4 访问次数:1947291 建立时间:2006年5月25日 |
|  .: 留言板 |  .: 链接 |

|