無限級菜單之popup版

來源:互聯網
上載者:User

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.