一个XML+JS的菜单,好用
来源:互联网 发布:心情无人知 编辑:程序博客网 时间:2024/04/28 01:23
<HTML>
<HEAD>
<TITLE> Menu </TITLE>
<style>...
body,td{...}{font:12px verdana}
#treemain{...}{background-color:#fffffa;}
#treemain .ec{...}{margin:0 5 0 5;}
#treemain .hasItems{...}{font-weight:bold;height:20px;padding:3 6 0 6;margin:2px;cursor:hand;color:#555555;border:1px solid #fffffa;}
#treemain .Items{...}{height:20px;padding:3 6 0 6;margin:1px;cursor:hand;color:#555555;border:1px solid #fffffa;}
</style>
<script>...
//code by star 20003-4-7
//debugger
var HC = "color:#990000;border:1px solid #cccccc";
var SC = "background-color:#efefef;border:1px solid #cccccc;color:#000000;";
var IO = null;
function initTree()...{
var rootn = document.all.menuXML.documentElement;
var sd = 0;
document.onselectstart = function()...{return false;}
document.all.treemain.appendChild(createTree(rootn,sd));
}
function createTree(thisn,sd)...{
var nodeObj = document.createElement("span");
var upobj = document.createElement("span");
with(upobj)...{
style.marginLeft = sd*10;
className = thisn.hasChildNodes()?"hasItems":"Items";
//根节点图片
innerHTML = "<img src=img/open.gif class=ec>" + thisn.getAttribute("text") +"";
onmousedown = function()...{
if(event.button != 1) return;
if(this.getAttribute("cn"))...{
this.setAttribute("open",!this.getAttribute("open"));
this.cn.style.display = this.getAttribute("open")?"inline":"none";
this.all.tags("img")[0].src = this.getAttribute("open")?"img/open.gif":"img/closed.gif";
}
if(IO)...{
IO.runtimeStyle.cssText = "";
IO.setAttribute("selected",false);
}
IO = this;
this.setAttribute("selected",true);
this.runtimeStyle.cssText = SC;
}
onmouseover = function()...{
if(this.getAttribute("selected"))return;
this.runtimeStyle.cssText = HC;
}
onmouseout = function()...{
if(this.getAttribute("selected"))return;
this.runtimeStyle.cssText = "";
}
oncontextmenu = contextMenuHandle;
onclick = clickHandle;
}
if(thisn.getAttribute("treeId") != null)...{
upobj.setAttribute("treeId",thisn.getAttribute("treeId"));
}
if(thisn.getAttribute("href") != null)...{
upobj.setAttribute("href",thisn.getAttribute("href"));
}
if(thisn.getAttribute("target") != null)...{
upobj.setAttribute("target",thisn.getAttribute("target"));
}
nodeObj.appendChild(upobj);
nodeObj.insertAdjacentHTML("beforeEnd","<br>")
if(thisn.hasChildNodes())...{
var i;
var nodes = thisn.childNodes;
var cn = document.createElement("span");
upobj.setAttribute("cn",cn);
if(thisn.getAttribute("open") != null)...{
upobj.setAttribute("open",(thisn.getAttribute("open")=="true"));
upobj.getAttribute("cn").style.display = upobj.getAttribute("open")?"inline":"none";
if( !upobj.getAttribute("open"))upobj.all.tags("img")[0].src ="img/closed.gif";
}
for(i=0;i<nodes.length;cn.appendChild(createTree(nodes[i++],sd+1)));
nodeObj.appendChild(cn);
}
else...{
upobj.all.tags("img")[0].src ="img/last.gif";
}
return nodeObj;
}
window.onload = initTree;
</script>
<script>...
function clickHandle()...{
// your code here
if (this.getAttribute("target") ==null)return;
window.parent.frames.main.location = this.getAttribute("href");
}
function contextMenuHandle()...{
event.returnValue = false;
var treeId = this.getAttribute("treeId");
// your code here
}
</script>
</HEAD>
<BODY>
<xml id=menuXML>
<?xml version="1.0" encoding="GB2312"?>
<DSTreeRoot text="Daxon绩效考核系统" open="true" href="#" treeId="123">
<DSTree text="管理者设定" open="false" treeId="">
<DSTree text="考核期间设定" href="managementPa_Period.aspx" target="main" treeId="4353" />
<DSTree text="绩效层级设定" href="managementPa_Rank.aspx" target="main" treeId="543543" />
<DSTree text="进度查询" href="managementPa_Schedule.aspx" target="main" treeId="543543" />
</DSTree>
<DSTree text="员工自评" open="false" treeId="">
<DSTree text="填写考核表单" open="false" href="#" treeId="213">
<DSTree text="Part1本期目标评核表" href="EmployeePa_Part1.aspx" target="main" treeId="4353" />
<DSTree text="Part2核心职能评核表" href="EmployeePa_Part2.aspx" target="main" treeId="543543" />
<DSTree text="Part3下期目标规划表" href="EmployeePa_Part3.aspx" target="main" treeId="543543" />
<DSTree text="Part4个人发展与建议表" href="EmployeePa_Part4.aspx" target="main" treeId="543543" />
</DSTree>
<DSTree text="修改年度目标规划" href="EmployeePA_MBOModify.aspx" target="main" treeId="4353" />
<DSTree text="查询员工自评" href="EmployeePA_SelfQurey.aspx" target="main" treeId="543543" />
</DSTree>
<DSTree text="主管考核" open="false" treeId="">
<DSTree text="直属部属考核" href="DirectorPa_BossAppr.aspx" target="main" treeId="4353" />
<DSTree text="所属员工绩效查询" href="DirectorPA_BossQry.aspx" target="main" treeId="543543" />
<DSTree text="MBO修改签核" href="DirectorPA_MBOAppr.aspx" target="main" treeId="543543" />
</DSTree>
<DSTree text="考核作业说明" open="false" treeId="">
</DSTree>
<DSTree text="回首页" open="false" href="default.aspx" target="_self" treeId="">
</DSTree>
</DSTreeRoot>
</xml>
<table style="position:absolute;left:10;top:10;">
<tr><td id=treemain style="width:220px;height:200px;border:1px solid #cccccc;padding:5 3 3 5;" valign=top></td></tr>
</table>
</BODY>
</HTML>
<HEAD>
<TITLE> Menu </TITLE>
<style>...
body,td{...}{font:12px verdana}
#treemain{...}{background-color:#fffffa;}
#treemain .ec{...}{margin:0 5 0 5;}
#treemain .hasItems{...}{font-weight:bold;height:20px;padding:3 6 0 6;margin:2px;cursor:hand;color:#555555;border:1px solid #fffffa;}
#treemain .Items{...}{height:20px;padding:3 6 0 6;margin:1px;cursor:hand;color:#555555;border:1px solid #fffffa;}
</style>
<script>...
//code by star 20003-4-7
//debugger
var HC = "color:#990000;border:1px solid #cccccc";
var SC = "background-color:#efefef;border:1px solid #cccccc;color:#000000;";
var IO = null;
function initTree()...{
var rootn = document.all.menuXML.documentElement;
var sd = 0;
document.onselectstart = function()...{return false;}
document.all.treemain.appendChild(createTree(rootn,sd));
}
function createTree(thisn,sd)...{
var nodeObj = document.createElement("span");
var upobj = document.createElement("span");
with(upobj)...{
style.marginLeft = sd*10;
className = thisn.hasChildNodes()?"hasItems":"Items";
//根节点图片
innerHTML = "<img src=img/open.gif class=ec>" + thisn.getAttribute("text") +"";
onmousedown = function()...{
if(event.button != 1) return;
if(this.getAttribute("cn"))...{
this.setAttribute("open",!this.getAttribute("open"));
this.cn.style.display = this.getAttribute("open")?"inline":"none";
this.all.tags("img")[0].src = this.getAttribute("open")?"img/open.gif":"img/closed.gif";
}
if(IO)...{
IO.runtimeStyle.cssText = "";
IO.setAttribute("selected",false);
}
IO = this;
this.setAttribute("selected",true);
this.runtimeStyle.cssText = SC;
}
onmouseover = function()...{
if(this.getAttribute("selected"))return;
this.runtimeStyle.cssText = HC;
}
onmouseout = function()...{
if(this.getAttribute("selected"))return;
this.runtimeStyle.cssText = "";
}
oncontextmenu = contextMenuHandle;
onclick = clickHandle;
}
if(thisn.getAttribute("treeId") != null)...{
upobj.setAttribute("treeId",thisn.getAttribute("treeId"));
}
if(thisn.getAttribute("href") != null)...{
upobj.setAttribute("href",thisn.getAttribute("href"));
}
if(thisn.getAttribute("target") != null)...{
upobj.setAttribute("target",thisn.getAttribute("target"));
}
nodeObj.appendChild(upobj);
nodeObj.insertAdjacentHTML("beforeEnd","<br>")
if(thisn.hasChildNodes())...{
var i;
var nodes = thisn.childNodes;
var cn = document.createElement("span");
upobj.setAttribute("cn",cn);
if(thisn.getAttribute("open") != null)...{
upobj.setAttribute("open",(thisn.getAttribute("open")=="true"));
upobj.getAttribute("cn").style.display = upobj.getAttribute("open")?"inline":"none";
if( !upobj.getAttribute("open"))upobj.all.tags("img")[0].src ="img/closed.gif";
}
for(i=0;i<nodes.length;cn.appendChild(createTree(nodes[i++],sd+1)));
nodeObj.appendChild(cn);
}
else...{
upobj.all.tags("img")[0].src ="img/last.gif";
}
return nodeObj;
}
window.onload = initTree;
</script>
<script>...
function clickHandle()...{
// your code here
if (this.getAttribute("target") ==null)return;
window.parent.frames.main.location = this.getAttribute("href");
}
function contextMenuHandle()...{
event.returnValue = false;
var treeId = this.getAttribute("treeId");
// your code here
}
</script>
</HEAD>
<BODY>
<xml id=menuXML>
<?xml version="1.0" encoding="GB2312"?>
<DSTreeRoot text="Daxon绩效考核系统" open="true" href="#" treeId="123">
<DSTree text="管理者设定" open="false" treeId="">
<DSTree text="考核期间设定" href="managementPa_Period.aspx" target="main" treeId="4353" />
<DSTree text="绩效层级设定" href="managementPa_Rank.aspx" target="main" treeId="543543" />
<DSTree text="进度查询" href="managementPa_Schedule.aspx" target="main" treeId="543543" />
</DSTree>
<DSTree text="员工自评" open="false" treeId="">
<DSTree text="填写考核表单" open="false" href="#" treeId="213">
<DSTree text="Part1本期目标评核表" href="EmployeePa_Part1.aspx" target="main" treeId="4353" />
<DSTree text="Part2核心职能评核表" href="EmployeePa_Part2.aspx" target="main" treeId="543543" />
<DSTree text="Part3下期目标规划表" href="EmployeePa_Part3.aspx" target="main" treeId="543543" />
<DSTree text="Part4个人发展与建议表" href="EmployeePa_Part4.aspx" target="main" treeId="543543" />
</DSTree>
<DSTree text="修改年度目标规划" href="EmployeePA_MBOModify.aspx" target="main" treeId="4353" />
<DSTree text="查询员工自评" href="EmployeePA_SelfQurey.aspx" target="main" treeId="543543" />
</DSTree>
<DSTree text="主管考核" open="false" treeId="">
<DSTree text="直属部属考核" href="DirectorPa_BossAppr.aspx" target="main" treeId="4353" />
<DSTree text="所属员工绩效查询" href="DirectorPA_BossQry.aspx" target="main" treeId="543543" />
<DSTree text="MBO修改签核" href="DirectorPA_MBOAppr.aspx" target="main" treeId="543543" />
</DSTree>
<DSTree text="考核作业说明" open="false" treeId="">
</DSTree>
<DSTree text="回首页" open="false" href="default.aspx" target="_self" treeId="">
</DSTree>
</DSTreeRoot>
</xml>
<table style="position:absolute;left:10;top:10;">
<tr><td id=treemain style="width:220px;height:200px;border:1px solid #cccccc;padding:5 3 3 5;" valign=top></td></tr>
</table>
</BODY>
</HTML>
- 一个XML+JS的菜单,好用
- 一个好用的多选菜单
- 一个好用的xml online viewer
- 转载,JS 好用的侧边栏菜单
- 一个比较好用的JS效验
- 一个好用的JS日期选择器
- 一个好用的js分页
- 一个好用的CSS下拉菜单源码
- js 菜单的好地方参考
- 给大家推荐一个比较好的JS菜单制作工具
- 一个简单的JS菜单
- 一个树形菜单的好类
- 一个树形菜单的好类
- 一个js的好地方
- JS +XML +Jquery 实现三级联动菜单,自己封装的一个对象方便使用
- 一个学习html(dom),js,css,xml等所有web技术的好网站
- 推荐一个超级好用的XML编辑器
- 一个不错的XML+Javascript树状菜单
- 湘西凤凰之行
- 把异常的堆栈跟踪输出保存到日志文件的方法
- 关于窗体和控件获取与失去输入焦点的事件
- TreeView的简单使用
- 关于 ”printk“解疑
- 一个XML+JS的菜单,好用
- RE: [评论]CSND的外包会不会贱卖程序员的劳动
- OpenMP并行程序设计
- cs8900在2.6.14上的移植
- 返回主机名和Ip地址(Delphi)
- 关于hook设置函数如何支持多核CPU的一个说明
- FCKeditor JSP版本安装手顺
- 正则表达式使用详解
- PC-Lint的lnt文件、配置方法,适用于VC++6.0与editplus