?? menumaker.jsp
字號:
<%!
Driver driver;
Connection connection;
PreparedStatement statement;
ResultSet resultset;
int SubHeight=20;
void MenuList(String parentId,String name,int position,StringBuffer outHTML,boolean init){
Vector childList=new Vector();
Vector nameList=new Vector();
try{
statement.setString(1,parentId);
resultset=statement.executeQuery();
while(resultset.next()){
childList.addElement(resultset.getString("ClassId"));
nameList.addElement(resultset.getString("Name"));
}
}catch(Exception e){;}
int msize=childList.size();
if(msize>0){
if(!init){//不為根節點
outHTML.append("<td class=\"OutMenu\" onClick=\"SubThis('"+parentId+"')\" onMouseOver=\"OverItem(this,'"+name+"');turnLayer('"+parentId+"','show')\" onMouseOut=\"OutItem(this);turnLayer('"+parentId+"','hide')\"><img src=\"../pic/more.gif\" align='right'>"+name+"\n");
outHTML.append("<div id=\""+parentId+"\" style=\"width:220px; position:absolute; left:118px; top:"+position*SubHeight+"px; visibility: hidden;\" onMouseOut=\"turnLayer('"+parentId+"','hide')\" >\n");
}
outHTML.append("<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" class=\"FixMenu\">\n");
for(int i=0;i<msize;i++){
outHTML.append("<tr>\n");
MenuList((String)childList.elementAt(i),(String)nameList.elementAt(i),i,outHTML,false);
outHTML.append("</tr>\n");
if(i<msize-1) outHTML.append("<tr><td height=\"2\" bgcolor=\"#000000\"></td></tr>");
}
outHTML.append("</table>\n");
if(!init){//不為根節點
outHTML.append("</div>\n");
outHTML.append("</td>\n");
}
}else{
outHTML.append("<td class=\"OutMenu\" onClick=\"SubThis('"+parentId+"')\" onMouseOver=\"OverItem(this,'"+name+"')\" onMouseOut=\"OutItem(this)\">"+name+"</td>\n");
}
return;
}
%>
<%
Driver driver = (Driver)Class.forName(DB_DRIVER).newInstance();
Connection connection = DriverManager.getConnection(DB_STRING,DB_USERNAME,DB_PASSWORD);
statement = connection.prepareStatement("SELECT ClassId,Name FROM TreeMenu WHERE ParentId= ? ORDER BY ChildIndex");
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -