📄 menutest.htm
字号:
<HTML>
<HEAD>
<TITLE> 无限菜单之 popup 版(IE5.5+) 雏形 --宝玉(webuc.net)</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<meta name="Author" content="宝玉(webuc.net)" />
<meta name="Description" content="使用ie5.5+中的popup创建的菜单——菜单可以超出浏览器区域、可以不用担心会被下拉选择框等东西挡住" />
<SCRIPT LANGUAGE="JScript">
var pops = new Array(); // 用来存储Popup窗口家族的数组
function CreatePopup(degree)
{
if (degree < 0) // 层数不能小于0
return null;
if (pops[degree] != null) //如果已经存在则不需创建
return pops[degree];
if (degree == 0)
pops[0] = window.createPopup(); //创建最顶层Popup窗口
else{
if (pops[degree - 1] == null)
pops[degree - 1] = CreatePopup(degree - 1) //递归回溯从第一层开始创建
pops[degree] = pops[degree - 1].document.parentWindow.createPopup(); //从父Popup窗口创建子Popup窗口
}
pops[degree].document.body.setAttribute("degree", degree);
return pops[degree];
}
CreatePopup(1); //创建一个2层的Popup家族
//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 onmouseover="this.style.background='gold';parent.ShowSubMenu()"
onmouseout="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 onmouseover="this.style.background='gold';parent.ShowSubMenu1()"
onmouseout="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 onmouseover="this.style.background='gold';parent.parent.ClearTimer()"
onmouseout="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 onmouseover="this.style.background='gold';parent.parent.ClearTimer()"
onmouseout="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 onmouseover="this.style.background='gold';parent.parent.ClearTimer()"
onmouseout="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 onmouseover="this.style.background='gold';parent.parent.ClearTimer()"
onmouseout="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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -