<HTML>
<HEAD>
<TITLE>无限级菜单之popup版(雏形)--WebUC.Net</TITLE>
<SCRIPT LANGUAGE="JScript">
// +------------------------
// 用popup来实现菜单
// 宝玉
// --------------------------
var pops = new Array();
function CreatePopup(degree)
{
if (degree < 0)
return null;
if (pops[degree] != null)
return pops[degree];
if (degree == 0)
pops[0] = window.createPopup();
else{
if (pops[degree - 1] == null)
pops[degree - 1] = CreatePopup(degree - 1) //递归哦
pops[degree] = pops[degree - 1].document.parentWindow.createPopup();
}
pops[degree].document.body.setAttribute("degree", degree);
return pops[degree];
}
CreatePopup(2);
//Creating the popup window object
var oPopup = pops[0];
var timer = null;
function ContextMenu()
{
var lefter = event.offsetY+10;
var topper = event.offsetX+10;
oPopup.document.body.innerHTML = oContextHTML.innerHTML;
//This popup is displayed relative to the body of the document.
oPopup.show(topper, lefter, 200, 65, document.body);
}
function ShowSubMenu()
{
ClearTimer();
pops[1].document.body.innerHTML = oContextHTML1.innerHTML;
//This popup is displayed relative to the body of the document.
pops[1].show(200, 0, 200, 65, pops[0].document.body);
}
function HideSubMenu()
{
ClearTimer();
timer = window.setTimeout("pops[1].hide()", 1000);
}
function ClearTimer()
{
if (timer != null)
window.clearTimeout(timer)
timer = null;
}
function ShowSubMenu1()
{
ClearTimer();
pops[1].hide();
pops[1].document.body.innerHTML = oContextHTML2.innerHTML;
//This popup is displayed relative to the body of the document.
pops[1].show(200, 30, 200, 65, pops[0].document.body);
}
</SCRIPT>
</HEAD>
<BODY onContextMenu="ContextMenu(); return false;">
<DIV ID="oContextHTML" STYLE="display:none;">
<DIV οnmοuseοver="this.style.background='gold';parent.ShowSubMenu()"
οnmοuseοut="this.style.background='#e4e4e4';parent.HideSubMenu()"
STYLE="font-family:verdana; font-size:70%; height:30px; background:#e4e4e4; border:1px solid black; padding:4px; cursor:hand ">
<SPAN ONCLICK="">
menu1</SPAN>
</DIV>
<DIV οnmοuseοver="this.style.background='gold';parent.ShowSubMenu1()"
οnmοuseοut="this.style.background='#e4e4e4';parent.HideSubMenu()"
STYLE="font-family:verdana; font-size:70%; height:30px; background:#e4e4e4; border:1px solid black; padding:4px; cursor:hand; border-top:0px solid black">
<SPAN ONCLICK="">
menu2</SPAN>
</DIV>
</DIV>
<DIV ID="oContextHTML1" STYLE="display:none;">
<DIV οnmοuseοver="this.style.background='gold';parent.parent.ClearTimer()"
οnmοuseοut="this.style.background='#e4e4e4';"
STYLE="font-family:verdana; font-size:70%; height:30px; background:#e4e4e4; border:1px solid black; padding:4px; cursor:hand ">
<SPAN ONCLICK="">
menu11</SPAN>
</DIV>
<DIV οnmοuseοver="this.style.background='gold';parent.parent.ClearTimer()"
οnmοuseοut="this.style.background='#e4e4e4'"
STYLE="font-family:verdana; font-size:70%; height:30px; background:#e4e4e4; border:1px solid black; padding:4px; cursor:hand; border-top:0px solid black">
<SPAN ONCLICK="">
menu12</SPAN>
</DIV>
</DIV>
<DIV ID="oContextHTML2" STYLE="display:none;">
<DIV οnmοuseοver="this.style.background='gold';parent.parent.ClearTimer()"
οnmοuseοut="this.style.background='#e4e4e4';"
STYLE="font-family:verdana; font-size:70%; height:30px; background:#e4e4e4; border:1px solid black; padding:4px; cursor:hand ">
<SPAN ONCLICK="">
menu21</SPAN>
</DIV>
<DIV οnmοuseοver="this.style.background='gold';parent.parent.ClearTimer()"
οnmοuseοut="this.style.background='#e4e4e4'"
STYLE="font-family:verdana; font-size:70%; height:30px; background:#e4e4e4; border:1px solid black; padding:4px; cursor:hand; border-top:0px solid black">
<SPAN ONCLICK="">
menu22</SPAN>
</DIV>
</DIV>
</BODY>
</HTML>