无限级菜单之popup版

<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>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值