xtree 显示树形目录

 版本1.17

框架

<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'MyJsp.jsp' starting page</title>

 <meta http-equiv="pragma" content="no-cache">
 <meta http-equiv="cache-control" content="no-cache">
 <meta http-equiv="expires" content="0">   
  </head>
  <frameset cols="150,*" frameborder="yes" border="1" framespacing="0" style="position:absolute; top:0; left:0;" id="portalFrm" name="portalFrm">
          <frame src="left.jsp" name="leftFrame" scrolling="no" noresize>//左面显示xtree树
          <frame src="right.jsp" name="rightFrame" scrolling="no" noresize>  //右面显示响应内容
</frameset>
<noframes><body>
</body></noframes>

</html>

左边frame----xtree树形目录left.jsp

<%@ page language="java" pageEncoding="gbk"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

 <title>首页</title>
 
 
<script src="xtree.js"></script>

<!-- Modify this file to change the way the tree looks -->
<link type="text/css" rel="stylesheet" href="xtree.css">

<style>
 body { background: white; color: black; }
 input { width: 120px; }
</style>
<script>
  function father_location(subframe,locate)//将右边的frame显示为响应内容
    {
    parent.frames[subframe].location=locate;
    }
</script>
</head>
 
<body>
<script type="text/javascript">
 var tree = new WebFXTree('my系统');//根
 var p_000=new WebFXTreeItem('工作调度');//一级目录
 p_000.action='javascript:p_000.toggle()'; //WebFXTreeItem对象有一个toggle()函数,可以控制目录的展开和关闭
 var p_001=new WebFXTreeItem('作业管理');//二级目录
 p_001.action="javascript:father_location('rightFrame','<%=request.getContextPath()%>/job/jobview.action')";//WebFXTreeItem对象的action属性可以指定要链接到的url
 var p_002=new WebFXTreeItem('调度管理');//二级目录
 p_002.action="javascript:father_location('rightFrame','<%=request.getContextPath()%>/scheduler/schedule.jsp')";
 p_000.add(p_001);//将将二级目录填入一级目录
    p_000.add(p_002);//将将二级目录填入一级目录
   
 var p_010=new WebFXTreeItem('ajax');//一级目录
 p_010.action='javascript:p_010.toggle()';
 var p_011=new WebFXTreeItem('动态列表');//二级目录
 p_011.action="javascript:father_location('rightFrame','<%=request.getContextPath()%>/ajax/dynamiclists.jsp')";
 var p_012=new WebFXTreeItem('访问web服务');//二级目录
 p_012.action="javascript:father_location('rightFrame','<%=request.getContextPath()%>/ajax/websearch.jsp')";
 p_010.add(p_011);//将将二级目录填入一级目录
 p_010.add(p_012);//将将二级目录填入一级目录
   
    tree.add(p_000);//将将一级目录填入根
    tree.add(p_010);//将将一级目录填入根
    document.write(tree);//最后,用document.write(根对象);写到页面显示
  
</script> 
</body>
</html>

最后效果:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值