Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 网站建设 > 网页制作 > 树状菜单
【标  题】:树状菜单
【关键字】:
【来  源】:http://www.cublog.cn/u/15320/showart.php?id=238130

树状菜单

Your Ad Here
文件: LDM.zip
大小: 22KB
下载: 下载

<html>
<head>
 <title>JavaScript Navigation Tree</title>
 <style>
 /* Style for tree item text */
 .t0i {
  font-family: Tahoma, Verdana, Geneva, Arial, Helvetica, sans-serif;
  font-size: 11px;
  color: #000000;
  background-color: #ffffff;
  text-decoration: none;
 }
 /* Style for tree item image */
 .t0im {
  border: 0px;
  width: 19px;
  height: 16px;
 }
 </style>
</head>
<body bgcolor="#ffffff" leftmargin="15" marginheight="2" marginwidth="15" topmargin="2">
<div style="position:absolute;width:2px;height:515px;left: 190px;top:0px;border:0px solid black;background-color:DDDDDD;" >
</div>
<script>
function tree (a_items, a_template) {
 this.a_tpl      = a_template;
 this.a_config   = a_items;
 this.o_root     = this;
 this.a_index    = [];
 this.o_selected = null;
 this.n_depth    = -1;
 
 var o_icone = new Image(),
  o_iconl = new Image();
 o_icone.src = a_template['icon_e'];
 o_iconl.src = a_template['icon_l'];
 a_template['im_e'] = o_icone;
 a_template['im_l'] = o_iconl;
 for (var i = 0; i < 64; i++)
  if (a_template['icon_' + i]) {
   var o_icon = new Image();
   a_template['im_' + i] = o_icon;
   o_icon.src = a_template['icon_' + i];
  }
 
 this.toggle = function (n_id) { var o_item = this.a_index[n_id]; o_item.open(o_item.b_opened) };
 this.select = function (n_id) { return this.a_index[n_id].select(); };
 this.mout   = function (n_id) { this.a_index[n_id].upstatus(true) };
 this.mover  = function (n_id) { this.a_index[n_id].upstatus() };
 this.a_children = [];
 
 for (var i = 0; i < a_items.length; i++)
  new tree_item(this, i);
 this.n_id = trees.length;
 trees[this.n_id] = this;
 
 for (var i = 0; i < this.a_children.length; i++) {
  document.write(this.a_children[i].init());
  this.a_children[i].open();
 }
}
function tree_item (o_parent, n_order) {
 this.n_depth  = o_parent.n_depth + 1;
 this.a_config = o_parent.a_config[n_order + (this.n_depth ? 2 : 0)];
 if (!this.a_config) return;
       
 this.o_root    = o_parent.o_root;
 this.o_parent  = o_parent;
 this.n_order   = n_order;
 this.b_opened  = !this.n_depth;
 this.n_id = this.o_root.a_index.length;
 this.o_root.a_index[this.n_id] = this;
 o_parent.a_children[n_order] = this;
      this.a_children = [];
 for (var i = 0; i < this.a_config.length - 2; i++)
  new tree_item(this, i);
 this.get_icon = item_get_icon;
 this.open     = item_open;
 this.select   = item_select;
 this.init     = item_init;
 this.upstatus = item_upstatus;
 this.is_last  = function () { return this.n_order == this.o_parent.a_children.length - 1 };
}
function item_open (b_close) {
 var o_idiv = get_element('i_div' + this.o_root.n_id + '_' + this.n_id);
 if (!o_idiv) return;
 
 if (!o_idiv.innerHTML) {
  var a_children = [];
  for (var i = 0; i < this.a_children.length; i++)
   a_children[i]= this.a_children[i].init();
  o_idiv.innerHTML = a_children.join('');
 }
 o_idiv.style.display = (b_close ? 'none' : 'block');
 
 this.b_opened = !b_close;
 var o_jicon = document.images['j_img' + this.o_root.n_id + '_' + this.n_id],
  o_iicon = document.images['i_img' + this.o_root.n_id + '_' + this.n_id];
 if (o_jicon) o_jicon.src = this.get_icon(true);
 if (o_iicon) o_iicon.src = this.get_icon();
 this.upstatus();
}
function item_select (b_deselect) {
 if (!b_deselect) {
  var o_olditem = this.o_root.o_selected;
  this.o_root.o_selected = this;
  if (o_olditem) o_olditem.select(true);
  
 }
 //var o_iicon = document.images['i_img' + this.o_root.n_id + '_' + this.n_id];
 
 //if (o_iicon)
 //o_iicon.src = this.get_icon();
 get_element('i_txt' + this.o_root.n_id + '_' + this.n_id).style.fontWeight = b_deselect ? 'normal' : 'bold';
 //this.upstatus();
      
 return Boolean(this.a_config[1]);
}
function item_upstatus (b_clear) {
 window.setTimeout('window.status="' + (b_clear ? '' : this.a_config[0] + (this.a_config[1] ? ' ('+ this.a_config[1] + ')' : '')) + '"', 10);
}
function item_init () {
 var a_offset = [],
  o_current_item = this.o_parent;
 for (var i = this.n_depth; i > 1; i--) {
 
  a_offset[i] = '<img src="' + this.o_root.a_tpl[o_current_item.is_last() ? 'icon_e' : 'icon_l'] + '" border="0" align="absbottom">';
  o_current_item = o_current_item.o_parent;
 }
 
 return '<table cellpadding="0" cellspacing="0" border="0"><tr><td nowrap>' + (this.n_depth ? a_offset.join('') + (this.a_children.length
  ? '<a href="javascript: trees[' + this.o_root.n_id + '].toggle(' + this.n_id + ')" onmouseover="trees[' + this.o_root.n_id + '].mover(' + this.n_id + ')" onmouseout="trees[' + this.o_root.n_id + '].mout(' + this.n_id + ')"><img src="' + this.get_icon(true) + '" border="0" align="absbottom" name="j_img' + this.o_root.n_id + '_' + this.n_id + '"></a>'
  : '<img src="' + this.get_icon(true) + '" border="0" align="absbottom">') : '')
  + '<a href="' + this.a_config[1] + '" target="' + this.o_root.a_tpl['target'] + '" onclick="return trees[' + this.o_root.n_id + '].select(' + this.n_id + ')" ondblclick="trees[' + this.o_root.n_id + '].toggle(' + this.n_id + ')" onmouseover="trees[' + this.o_root.n_id + '].mover(' + this.n_id + ')" onmouseout="trees[' + this.o_root.n_id + '].mout(' + this.n_id + ')" class="t' + this.o_root.n_id + 'i" id="i_txt' + this.o_root.n_id + '_' + this.n_id + '"><img src="' + this.get_icon() + '" border="0" align="absbottom" name="i_img' + this.o_root.n_id + '_' + this.n_id + '" class="t' + this.o_root.n_id + 'im">' + this.a_config[0] + '</a></td></tr></table>' + (this.a_children.length ? '<div id="i_div' + this.o_root.n_id + '_' + this.n_id + '" style="display:none"></div>' : '');
}
function item_get_icon (b_junction) {
 return this.o_root.a_tpl['icon_' + ((this.n_depth ? 0 : 32) + (this.a_children.length ? 16 : 0) + (this.a_children.length && this.b_opened ? 8 : 0) + (!b_junction && this.o_root.o_selected == this ? 4 : 0) + (b_junction ? 2 : 0) + (b_junction && this.is_last() ? 1 : 0))];
}
var trees = [];
get_element = document.all ?
 function (s_id) { return document.all[s_id] } :
 function (s_id) { return document.getElementById(s_id) };
 
var TREE_ITEMS = [['法院扣押暨疑似詐騙系統', null,['法院扣押', null,['分行作業',null,['鍵檔',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Status Report&MenuId=121');" ],['維護當日案件',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Minutes of Meeting&MenuId=122');" ],['退件待處理清單',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Requirement&MenuId=123');" ],['案件查詢',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Design&MenuId=124');" ]]
,['發文作業',null,['待發文處理清單',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Status Report&MenuId=121');" ],['發文維護',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Minutes of Meeting&MenuId=122');" ],['再次發文',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Requirement&MenuId=123');" ],['會辦作業',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Design&MenuId=124');" ],['會辦案件維護',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Design&MenuId=124');" ],['帳務處理',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Design&MenuId=124');" ]]
,['案件查詢及報表',null,['案件查詢',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Status Report&MenuId=121');" ],['收文統計表',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Minutes of Meeting&MenuId=122');" ],['用印本',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Requirement&MenuId=123');" ],['掛號單',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Design&MenuId=124');" ]],['參數維護',null,['分行代碼',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Status Report&MenuId=121');" ],['機關代碼',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Minutes of Meeting&MenuId=122');" ],['會辦單位',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Requirement&MenuId=123');" ],['作業規範',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Design&MenuId=124');" ]]],['疑似詐騙', null,['分行作業',null,['案件查詢',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Status Report&MenuId=121');" ]]
,['通報作業',null,['鍵檔',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Status Report&MenuId=121');" ],['維護案件',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Minutes of Meeting&MenuId=122');" ],['案件查詢',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Requirement&MenuId=123');" ],['掛號單即通知信函',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Design&MenuId=124');" ]]
,['參數維護',null,['通報單位',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Status Report&MenuId=121');" ],['案情描述',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Minutes of Meeting&MenuId=122');" ],['警示狀態',"javascript:fnSubmitLeft('/CTCBWeb2/ProjectController?REQUEST=UPLOAD&ProjectId=KISS&DocumentDesc=Requirement&MenuId=123');" ]]]]]

var tree_tpl = {
 'target'  : '_self', // name of the frame links will be opened in
       // other possible values are: _blank, _parent, _search, _self and _top
 'icon_e'  : 'icons/empty.gif', // empty image
 'icon_l'  : 'icons/line.gif',  // vertical line
 
 'icon_48' : 'icons/base.gif',   // root icon normal
 'icon_52' : 'icons/base.gif',   // root icon selected
 'icon_56' : 'icons/base.gif',   // root icon opened
 'icon_60' : 'icons/base.gif',   // root icon selected
 
 'icon_16' : 'icons/folder.gif', // node icon normal
 'icon_20' : 'icons/folder.gif', // node icon selected
 'icon_24' : 'icons/folderopen.gif', // node icon opened
 'icon_28' : 'icons/folderopen.gif', // node icon selected opened
 'icon_0'  : 'icons/folder.gif', // leaf icon normal
 'icon_4'  : 'icons/folderopen.gif', // leaf icon selected
 'icon_8'  : 'icons/folderopen.gif', // leaf icon opened
 'icon_12' : 'icons/folderopen.gif', // leaf icon selected
 
 'icon_2'  : 'icons/joinbottom.gif', // junction for leaf
 'icon_3'  : 'icons/join.gif',       // junction for last leaf
 'icon_18' : 'icons/plusbottom.gif', // junction for closed node
 'icon_19' : 'icons/plus.gif',       // junctioin for last closed node
 'icon_26' : 'icons/minusbottom.gif',// junction for opened node
 'icon_27' : 'icons/minus.gif'       // junctioin for last opended node
};

function fnSubmitLeft(val) {
 //alert(val);
   parent.DOCSELECT.location.href=val;
};
new tree (TREE_ITEMS, tree_tpl);

</script>

</body>
</html>
如何预防青春痘治疗青春痘背上的痘痘如何消除青春痘康本给你健康:【上一篇】
技术文摘:【下一篇】
【相关文章】
没有相关文章
【随机文章】
  • AS3的哈希实现
  • 影随鼠动的Flash文字动画
  • Eclipse的BPEL
  • 计算机网络第4版[1.2]--网络硬件
  • CCNA认证考试最新真题
  • 病毒名称 YahoLogon(HTML.YahoLogon)
  • 使用JDK替换GIJ
  • UNIX Shell范例精解(第3版)
  • IBM虚拟带库的配置
  • web.xml的filter执行顺序导致的乱码,切记!
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 bbb软讯网络 All Rigths Reserved.