⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 popupwindow.js

📁 事件提醒系统
💻 JS
📖 第 1 页 / 共 2 页
字号:
        else
        {
            me.offset += me.step;
        }

        header._popup.show(x, y, width, height);
    };

    header._timer = window.setInterval(fun, this.speed);
};

/**
 * 显示菜单窗口。
 * 菜单项的格式为:{text:"菜单项文本", icon:"../x.gif", handler:"菜单项处理函数"}
 */
PopupWindow.prototype.showMenu = function()
{
    if (this.wtype == WIN_MESSAGE) {
        return;
    }

    var str = "<html><head><style>";
    str += ".ContextMenu{border:#718da6 1px solid;padding: 1px;background: #f5f7f8;filter: progid:DXImageTransform.Microsoft.Shadow(color=#808080, direction=135, strength=3);}";
    str += ".ContextMenuItem{background:none transparent scroll repeat 0% 0%;border:0px;width:100%;cursor:default;}";
    str += ".ContextMenuItemHover{border:#316ac5 1px solid;background:#c1d2ee;width:100%;cursor:default;}";
    str += ".ContextMenuSepline{border-top:#aaaaaa 1px solid;border-bottom:#ffffff 1px solid;overflow:hidden;width:100%;height:2px;}";
    str += "</style></head><body class='ContextMenu' style='margin:0;padding:0;overflow:hidden;width:" + this.width + "px;'>";

    str += "<table cellpadding=0 cellspacing=0 border=0 width='100%'><tr><td width=22 valign=bottom bgcolor='#396DA5'><img src='" + this.imageRoot + "erp.ver2.gif' border=0></td><td valign=top style='padding:2px;'>";

    str += "<table id='pnlTable' cellpadding=0 cellspacing=0 border=0 width='100%'>";

    var h = 0;
    var idx, menuItem, itemIndex = 0;
    if (this.menus != null) {
        for (idx = 0; idx < this.menus.length; idx++)
        {
            menuItem = this.menus[idx];
            if (menuItem.text == "-")
            {
                str += "<tr height=6><td style='padding:2px 5px 2px 32px;'><div class=ContextMenuSepline></div></td></tr>";
                h += 6;
            }
            else
            {
                str += "<tr height=32>";
                str += "<td class='ContextMenuItem' onmouseover='this.className=\"ContextMenuItemHover\";' onmouseout='this.className=\"ContextMenuItem\";'"
                    //+ " id='" + menuItem.id + "' icon='" + menuItem.icon + "'>";
                    + " menuid='" + menuItem.id + "' icon='" + menuItem.icon + "' id='item" + itemIndex + "'>";

                str += "<table cellpadding=0 cellspacing=0 border=0 width='100%'><tr><td width=32 align=center>";
                if (menuItem.icon != null && menuItem.icon != "") {
                    str += "<img src='" + this.imageRoot + menuItem.icon + "' border=0 align=absmiddle>";
                }
                str += "</td><td style='font-size:12px;'>";

                str += menuItem.text + "</td></tr></table>";
                str += "</tr>";

                itemIndex++;
                h += 32;
            }
        }
    }
    str += "</table>";
    str += "</td></tr></table>";
    str += "</body></html>";

    //header._popup.document.body.innerHTML = str;
    header._popup.document.write(str);

    this.height = h + 4; // header._popup.document.getElementById("contextMenu").style.height;
    if (this.height < 210) this.height = 210;
    this.top    = this.bottom - this.height;

    str = null;

    this.offset = 0;
    var me = this;

    header._popup.document.body.onmouseover = function(){me.paused = true;};
    header._popup.document.body.onmouseout = function(){me.paused = false;};

    //var o = new Array();
    //for (idx = 0; idx < itemIndex; idx++) {
    //    o[idx] = header._popup.document.getElementById( "item" + idx );
    //    if (o[idx]) o[idx].onclick = function() {
    //        me.onClickMenuItem( o[idx].menuid, o[idx].icon );
    //        me.close();
    //    };
    //}
    var o0  = header._popup.document.getElementById( "item0" );  if (o0)  o0.onclick  = function() { me.onClickMenuItem( o0.menuid, o0.icon ); me.close(); };
    var o1  = header._popup.document.getElementById( "item1" );  if (o1)  o1.onclick  = function() { me.onClickMenuItem( o1.menuid, o1.icon ); me.close(); };
    var o2  = header._popup.document.getElementById( "item2" );  if (o2)  o2.onclick  = function() { me.onClickMenuItem( o2.menuid, o2.icon ); me.close(); };
    var o3  = header._popup.document.getElementById( "item3" );  if (o3)  o3.onclick  = function() { me.onClickMenuItem( o3.menuid, o3.icon ); me.close(); };
    var o4  = header._popup.document.getElementById( "item4" );  if (o4)  o4.onclick  = function() { me.onClickMenuItem( o4.menuid, o4.icon ); me.close(); };
    var o5  = header._popup.document.getElementById( "item5" );  if (o5)  o5.onclick  = function() { me.onClickMenuItem( o5.menuid, o5.icon ); me.close(); };
    var o6  = header._popup.document.getElementById( "item6" );  if (o6)  o6.onclick  = function() { me.onClickMenuItem( o6.menuid, o6.icon ); me.close(); };
    var o7  = header._popup.document.getElementById( "item7" );  if (o7)  o7.onclick  = function() { me.onClickMenuItem( o7.menuid, o7.icon ); me.close(); };
    var o8  = header._popup.document.getElementById( "item8" );  if (o8)  o8.onclick  = function() { me.onClickMenuItem( o8.menuid, o8.icon ); me.close(); };
    var o9  = header._popup.document.getElementById( "item9" );  if (o9)  o9.onclick  = function() { me.onClickMenuItem( o9.menuid, o9.icon ); me.close(); };
    var o10 = header._popup.document.getElementById( "item10" ); if (o10) o10.onclick = function() { me.onClickMenuItem( o10.menuid, o10.icon ); me.close(); };
    var o11 = header._popup.document.getElementById( "item11" ); if (o11) o11.onclick = function() { me.onClickMenuItem( o11.menuid, o11.icon ); me.close(); };
    var o12 = header._popup.document.getElementById( "item12" ); if (o12) o12.onclick = function() { me.onClickMenuItem( o12.menuid, o12.icon ); me.close(); };
    var o13 = header._popup.document.getElementById( "item13" ); if (o13) o13.onclick = function() { me.onClickMenuItem( o13.menuid, o13.icon ); me.close(); };
    var o14 = header._popup.document.getElementById( "item14" ); if (o14) o14.onclick = function() { me.onClickMenuItem( o14.menuid, o14.icon ); me.close(); };
    var o15 = header._popup.document.getElementById( "item15" ); if (o15) o15.onclick = function() { me.onClickMenuItem( o15.menuid, o15.icon ); me.close(); };
    var o16 = header._popup.document.getElementById( "item16" ); if (o16) o16.onclick = function() { me.onClickMenuItem( o16.menuid, o16.icon ); me.close(); };
    var o17 = header._popup.document.getElementById( "item17" ); if (o17) o17.onclick = function() { me.onClickMenuItem( o17.menuid, o17.icon ); me.close(); };
    var o18 = header._popup.document.getElementById( "item18" ); if (o18) o18.onclick = function() { me.onClickMenuItem( o18.menuid, o18.icon ); me.close(); };
    var o19 = header._popup.document.getElementById( "item19" ); if (o19) o19.onclick = function() { me.onClickMenuItem( o19.menuid, o19.icon ); me.close(); };

    var fun = function()
    {
        var x = me.left;
        var y = 0;
        var width = me.width;
        var height = 0;

        if (me.offset > me.height)
        {
            height = me.height;
        }
        else
        {
            height = me.offset;
        }

        y = me.bottom - me.offset;

        if (y <= me.top)
        {
        }
        else
        {
            me.offset += me.step;
        }

        header._popup.show(x, y, width, height);
    };

    header._timer = window.setInterval(fun, this.speed);
};

/**
 * 关闭消息窗口(渐退方式)。
 */
PopupWindow.prototype.hide = function()
{
    if (header._timer > 0)
    {
        window.clearInterval(header._timer);
        header._timer = 0;
    }

    if (header._popup == null || !header._popup.isOpen)
    {
        return;
    }

    var me = this;

    var fun = function()
    {
        if (!me.paused || me.closing)
        {
            var x = me.left;
            var y = 0;
            var width = me.width;
            var height = 0;

            if (me.offset > 0)
            {
                height = me.offset;
            }

            y = me.bottom - height;

            if (y >= me.bottom)
            {
                closePopup();
            }
            else
            {
                me.offset -= me.step;
            }

            header._popup.show(x, y, width, height);
        }
    };

    header._timer = window.setInterval(fun, this.speed);
};

/**
 * 关闭消息窗口(立即关闭)。
 */
PopupWindow.prototype.close = function()
{
    closePopup();
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -