老裴帮助关于Javascript带右键功能的动态菜单树的小练习

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
 String path = request.getContextPath();
 String basePath = request.getScheme() + "://"
   + request.getServerName() + ":" + request.getServerPort()
   + path + "/";
 int treelength = -1 ;
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <base href="<%=basePath%>">
  <title>带右键的菜单树</title>
  <meta http-equiv="pragma" content="no-cache">
  <meta http-equiv="cache-control" content="no-cache">
  <link type="text/css" rel="stylesheet"
   href="<%=path%>/js/rightmenutree/dtree.css">
  <script type="text/javascript"
   src="<%=path%>/js/rightmenutree/TreeTools.js"></script>
  <style type="text/css"></style>
 </head>
  <body oncontextmenu=window.event.returnValue=false  onload="displaySpan(0)">
 <!-- 禁止页面右键 oncontextmenu=window.event.returnValue=false-->
  <div id="treecontentborder" >

    <table width="100%" align="center">
     <tr>
      <td>
      <script type="text/javascript">
      
     var t = new trees("<font color=blue>菜单树</font>(右键添加)",icon.root); 
     t.loadMenu(true); 
     t.addMenuItem("sperator","1","","http://","ROOT"); 
     t.addMenuItem("addClass","0","添加分类","http://","ROOT","addClass()");
     t.addMenuItem("sperator","1","","http://","ROOT");
     t.addMenuItem("delClass","0","删除分类","http://","ROOT","delClass()");
     t.addMenuItem("openFold","4","展开/折叠","http://","CHILD","loadALLInterface()");
     t.setRootURL("<%=path%>/js/rightmenutree/");
          t.childURL("<%=path%>/pages/common/getTreeView.jsp",-1);
          t.draw();
          t.init();
      
      
      </script>
      </td>
     </tr>
    </table>
  </div>
 </body>
 <script type="text/javascript"> 
 function addClass(){
 alert("添加成功");
 }
 function delClass(){
 alert("删除成功");
 }
 function nodeSelect(a,b,c,d) 
 
 }  
    function displaySpan(num)
   {
  try{
   <%
  if(0>0)
     {
   %>
     var i=num;
     if(i<arrySpan.length)
      {
     if(arrySpan[i].length>0)
     {
          var spanList = document.getElementById("span_"+arrySpan[i]);
       var thisID = spanList.titles;
             thisID = thisID.substring(3);
       loadchild(thisID);
             i=i+1;
             displaySpan(i);
     }else
             {
               i=i+1;
      displaySpan(i);
    }
         }
   <%}%>
  }catch(e){}

   }
 </script>
</html>

你可能感兴趣的:(JavaScript,html,jsp,css,cache)