dhtml 界面UI (tree)

1.xml的部分代码(可以使用<userdata>传递url)

<item text="Books" id="books" open="1" call="1" select="1">
  <item text="Mystery !!! &amp; Thrillers" id="mystery" open="1">
   <item text="Bestsellers" id="bsthrillers" >
    <item text="Lawrence Block" id="lb">
     <userdata name="system">true</userdata>
    </item>

 

 

2.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
 <head>
  <title>Changing iconsets</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <meta name="title" content="Samples" />
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <link rel="icon" href="../common/favicon.ico" type="image/x-icon" />
  <link rel="shortcut icon" href="../common/favicon.ico" type="image/x-icon" />
  <link rel="stylesheet" href="../common/css/style.css" type="text/css" media="screen" />
 </head>
 <body>
    <link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxtree.css">
 <script  src="../../codebase/dhtmlxcommon.js"></script>
 <script  src="../../codebase/dhtmlxtree.js"></script>

 <table width="20%" style="float:left">
  <tr>
   <td valign="top">
    <div id="treeboxbox_tree0" style="width:100%; height:318px;border :1px solid Silver;"></div><br>

   </td>
  </tr>
  <tr>
   <td>&nbsp;</td>
  </tr>
 </table>
 <table style="width:80%;float:left;" border="1">
  <tr><td>
    <iframe name="right" src="" frameborder="1" width="100%" height="500"></iframe>
   </td>
  </tr>
 </table>
 
 <script>
   tree=new dhtmlXTreeObject("treeboxbox_tree0","100%","100%",0);

   tree.setSkin('dhx_skyblue');
   tree.setImagePath("../../codebase/imgs/");
   tree.setOnClickHandler(tonclick);//添加event
   tree.loadXML("tree_b.xml");
   
   function tonclick(id) {   //不用管id,我也不明白
       alert("Item " + tree.getItemText(id) + " was selected"+tree.getUserData(id,"system"));
      // window.frames["right"].location="10_tree_iconset.html"; //点击树形菜单,iframe会产生新页面

       window.frames["right"].location=tree.getUserData(id,"system");
   };
 </script>
   
 </body>
</html>

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值