%@page contentType="text/html; charset=GB2312"%>
%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
jsp:useBean id="menu" scope="page" class="ycoe.basic.MenuOpt"/>
jsp:setProperty name="menu" property="father" value="${param.father}"/>
div>
c:forEach var="m" items="${menu.vector}" varStatus = "c">
c:choose>
c:when test="${m.sub eq 'Y'}">
div onClick="showMenu('${m.mid}','${m.url}','${m.target}','father=${m.mid}')">
img src="pic/menu0.gif" id="img${m.mid}" alt="" style=" cursor:hand;">
a href="#" class="text1">${m.name}
/div>
div style="display:none;" id="tr${m.mid}">
div style="padding-left:12pt" id="${m.mid}">
/div>
/c:when>
c:otherwise>
div onclick="openMenu('${m.url}','${m.target}','${m.pa}');">
img src="pic/menu1.gif" id="img${m.mid}" alt="">
a href="#" class="text1">${m.name}
/div>
menu.js:
//operMenu(開啟下拉式功能表的ID,開啟的地址,連結開啟的目標,參數)。
//這是用在menu.jsp的方法
function showMenu(id,url,target,param){
var trObj = document.getElementById("tr"+id);
var tdObj = document.getElementById(id);
//try{
if(document.getElementById("tr"+id).style.display == "none"){
//顯示菜單
if(tdObj.innerHTML == null || tdObj.innerHTML == ""){
//提取資料
document.getElementById("tr"+id).style.display = "";
document.getElementById("img"+id).src = "pic/menu2.gif"
Bcandy(id,"page/menu.jsp",param,"");
openMenu(url,target,param);
}else{
//如果裡面有內容,直接顯示
document.getElementById("tr"+id).style.display = "";
document.getElementById("img"+id).src = "pic/menu2.gif"
openMenu(url,target,param);
}
//Bcandy(target,url,param,"");//開啟菜單連結
}else{
//隱藏菜單
document.getElementById("tr"+id).style.display = "none";
document.getElementById("img"+id).src = "pic/menu0.gif"
}
//}catch(e){}
}
//開啟菜單
function openMenu(url,target,param){
//這裡不用我寫了吧。有好幾種實現方法,建議使用ajax實現!
}