📄 leftmenu.js
字号:
//可定制的多级树型目录
//author Tommy Lee
function winClick() {
var targetId, srcElement,i=0,childi=0,imgID;
srcElement = window.event.srcElement;
targetId=srcElement.id;
//
//取得当前的targetID
if(targetId.indexOf("line")>=0||targetId.indexOf("img")>=0){
//计算id
if(targetId.indexOf("line")>=0){
imgID="img"+targetId.substring(7);
}else if(targetId.indexOf("img")>=0){
imgID=targetId;
targetId="outline"+targetId.substring(3);
}
//setPath(targetId); //设置路径
//将当前点击的tr的图片更改为arrowopen
for(i=0;i<document.all.tags("img").length;i++){
if(document.all.tags("img")(i).id.indexOf("img")>=0){
if(document.all.tags("img")(i).id.length>=imgID.length){
document.all.tags("img")(i).src='images/left_arrowclose.gif';
}
if(document.all.tags("img")(i).id==imgID){
document.all.tags("img")(i).src='images/left_arrowopen.gif';
}
}
}
//关闭所有id号小于当前点击的id的tr,并将图片改为arrowclose
for(i=0;i<document.all.tags("tr").length;i++){
//关掉所有不包含单击id的项
if(document.all.tags("tr")(i).id.length>targetId.length&&document.all.tags("tr")(i).id.indexOf(targetId)<0){
document.all.tags("tr")(i).style.display='none';
}
//关闭所有包含点击id且非孩子的项(>3)
if (document.all.tags("tr")(i).id.indexOf(targetId)>=0&&document.all.tags("tr")(i).id.length-targetId.length>3){
document.all.tags("tr")(i).style.display='none';
}
//包含所点击的id
if(document.all.tags("tr")(i).id.indexOf(targetId)>=0){
//对于包含的孩子,执行一下程序
if ((document.all.tags("tr")(i).id.length-targetId.length)==3){
if(document.all.tags("tr")(i).style.display==''){
document.all.tags("tr")(i).style.display='';
}else{
document.all.tags("tr")(i).style.display='';
}
}
}
}
}
}
//设置路径
function setPath(pathID){
var strPath="",rootID;
var num=0;
//判断是否最终节点
for(i=0;i<document.all.tags("tr").length;i++){
if(document.all.tags("tr")(i).id.indexOf(pathID)>=0){
num++;
}
}
//如果是最终节点,则进行路径显示
if(num==1){
for(i=1;i<=((pathID.length-7)/3);i++){
rootID=pathID.substring(0,7+3*i);
for(ii=0;ii<document.all.tags("tr").length;ii++){
if(document.all.tags("tr")(ii).id==rootID){
if(i==1)
strPath=document.all.tags("tr")(ii).innerText+":";
else if(i<((pathID.length-7)/3))
strPath+=document.all.tags("tr")(ii).innerText+" >";
else
strPath+=document.all.tags("tr")(ii).innerText;
}
}
}
window.parent.wtop.document.all.tags("span")(0).innerText=strPath;
}
}
document.onclick = winClick;
var _lstFocus = null;
// function OverItem(objTable){
// window.event.srcElement.style.color = '#5E101F';
// window.event.srcElement.style.background = '#96F3F6';
// if (window.event.srcElement.tagName = = "TR"){
// window.event.srcElement.style.background = "#96F3F6";}
// }
// }
// function OverItem()
//{
// var e = window.event.srcElement;
// while (e!=null && e.tagName != "TR"){
// e = e.parentElement;
// }
// if(e != null && e.tagName == "TR"){
// e.style.background = "#96F3F6";
// }
//}
// function outItem(){
// var e = window.event.srcElement;
// while (e!=null && e.tagName != "TR"){
// e = e.parentElement;
// }
// if(e != null && e.tagName == "TR"){
// e.style.background = "#e8eaff";
// }
// }
function clickItem1(objTable){
// 定制链接背景
var e = window.event.srcElement;
while (e!=null && e.tagName != "TR"){
e = e.parentElement;
}
if(e != null && e.tagName == "TR"){
e.style.background ="#e8eaff" ;
if(_lstFocus != null){
_lstFocus.style.background ="F9F9F9";
_lstFocus = e;
}else{
_lstFocus = e;
}
}
}
function clickItem(objTable){
// 定制链接背景
var e = window.event.srcElement;
while (e!=null && e.tagName != "TR"){
e = e.parentElement;
}
if(e != null && e.tagName == "TR"){
e.style.background = "#FFFFFF";
if(e != _lstFocus)
{
if(_lstFocus != null){
_lstFocus.style.background = "#DCEAFF"
_lstFocus = e
}else{
_lstFocus = e;
}
}
}
}
function displayItem(functonid){
var e ;
temptargetId=functonid.substring(0,functonid.length);
targetId="outline"+functonid.substring(0,functonid.length);
if(targetId.indexOf("line")>=0||targetId.indexOf("img")>=0){
//计算id
//关闭所有id号小于当前点击的id的tr,并将图片改为arrowclose
for(i=0;i<document.all.tags("tr").length;i++){
if (document.all.tags("tr")(i).id.length>9){
document.all.tags("tr")(i).style.display='none';
}
if (document.all.tags("tr")(i).id==targetId){
e=document.all.tags("tr")(i);
}
}
for(j=1;j<=temptargetId.length /3;j++){
tempid="outline"+temptargetId.substring(0,j*3);
for(i=0;i<document.all.tags("tr").length;i++){
if(document.all.tags("tr")(i).id.indexOf(tempid)>=0){
//对于包含的孩子,执行一下程序
if ((document.all.tags("tr")(i).id.length-tempid.length)==3){
if(document.all.tags("tr")(i).style.display==''){
document.all.tags("tr")(i).style.display='';
}else{
document.all.tags("tr")(i).style.display='';
}
}
}
}
}
}
while (e!=null && e.tagName != "TR"){
e = e.parentElement;
//alert(e.id);
}
if(e != null && e.tagName == "TR"){
e.style.background = "#FFFFFF";
if(_lstFocus != null){
_lstFocus.style.background = "#e8eaff"
_lstFocus = e
}else{
_lstFocus = e;
}
}
}
function clickItemTr(objTable){
// 定制链接背景
var e = window.event.srcElement;
while (e!=null && e.tagName != "TR"){
e = e.parentElement;
}
if(e != null && e.tagName == "TR"){
e.style.background = "#F7F7CC";
if(e != _lstFocus)
{
if(_lstFocus != null){
_lstFocus.style.background = "#FFFFFF"
_lstFocus = e
}else{
_lstFocus = e;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -