BBS(php & mysql)完整版(六)


Posted in PHP onOctober 09, 2006

+proto.menuBorder;
            var focusItem = body.document.layers[n];
            focusItem.clip.width = body.clip.width;
            focusItem.Menu = l.Menu;
            focusItem.top = -30;
            focusItem.captureEvents(Event.MOUSEDOWN);
            focusItem.onmousedown = onMenuItemDown;
            menu.document.bgColor = proto.menuBorderBgColor;
            var lite = menu.document.layers[0];
            lite.document.bgColor = proto.menuLiteBgColor;
            lite.clip.width = body.clip.width +1;
            lite.clip.height = body.clip.height +1;
            menu.clip.width = body.clip.width + (proto.menuBorder * 3) ;
            menu.clip.height = body.clip.height + (proto.menuBorder * 3);
        }
    } else {
        if ((!document.all) && (container.hasChildNodes)) {
            container.innerHTML=content;
        } else {
            container.document.open("text/html");
            container.document.writeln(content);
            container.document.close();     
        }
        if (!FIND("menuLayer0")) return;
        var menuCount = 0;
        for (var x=0; x<container.menus.length; x++) {
            var menuLayer = FIND("menuLayer" + x);
            container.menus[x].menuLayer = "menuLayer" + x;
            menuLayer.Menu = container.menus[x];
            menuLayer.Menu.container = "menuLayer" + x;
            menuLayer.style.zIndex = 1;
            var s = menuLayer.style;
            s.top = s.pixelTop = -300;
            s.left = s.pixelLeft = -300;

            var menu = container.menus[x];
            menu.menuItemWidth = menu.menuWidth || menu.menuIEWidth || 140;
            menuLayer.style.backgroundColor = menu.menuBorderBgColor;
            var top = 0;
            for (var i=0; i<container.menus[x].items.length; i++) {
                var l = FIND("menuItem" + menuCount);
                l.Menu = container.menus[x];
                if (l.addEventListener) { // ns6
                    l.style.width = menu.menuItemWidth;     
                    l.style.height = menu.menuItemHeight;
                    l.style.top = top;
                    l.addEventListener("mouseover", onMenuItemOver, false);
                    l.addEventListener("click", onMenuItemAction, false);
                    l.addEventListener("mouseout", mouseoutMenu, false);
                } else { //ie
                    l.style.pixelWidth = menu.menuItemWidth;     
                    l.style.pixelHeight = menu.menuItemHeight;
                    l.style.pixelTop = top;
                }
                top = top + menu.menuItemHeight+menu.menuItemBorder;
                l.style.fontSize = menu.fontSize;
                l.style.backgroundColor = menu.menuItemBgColor;
                l.style.visibility = "inherit";
                l.saveColor = menu.menuItemBgColor;
                l.menuHiliteBgColor = menu.menuHiliteBgColor;
                l.action = container.menus[x].actions[i];
                l.hilite = FIND("menuItemHilite" + menuCount);
                l.focusItem = FIND("focusItem" + x);
                l.focusItem.style.pixelTop = l.focusItem.style.top = -30;
                var childItem = FIND("childMenu" + menuCount);
                if (childItem) {
                    l.childMenu = container.menus[x].items[i].menuLayer;
                    childItem.style.pixelLeft = childItem.style.left = menu.menuItemWidth -11;
                    childItem.style.pixelTop = childItem.style.top =(menu.menuItemHeight /2) -4;
                    //childItem.style.pixelWidth = 30 || 7;
                    //childItem.style.clip = "rect(0 7 7 3)";
                    l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;
                }
                var sep = FIND("menuSeparator" + menuCount);
                if (sep) {
                    sep.style.clip = "rect(0 " + (menu.menuItemWidth - 3) + " 1 0)";
                    sep.style.width = sep.style.pixelWidth = menu.menuItemWidth;     
                    sep.style.backgroundColor = menu.bgColor;
                    sep = FIND("menuSeparatorLite" + menuCount);
                    sep.style.clip = "rect(1 " + (menu.menuItemWidth - 3) + " 2 0)";
                    sep.style.width = sep.style.pixelWidth = menu.menuItemWidth;     
                    sep.style.backgroundColor = menu.menuLiteBgColor;
                    l.style.height = l.style.pixelHeight = menu.menuItemHeight/2;
                    l.isSeparator = true
                    top -= (menu.menuItemHeight - l.style.pixelHeight)
                } else {
                    l.style.cursor = "hand"
                }
                menuCount++;
            }
            menu.menuHeight = top-1;
            var lite = FIND("menuLite" + x);
            var s = lite.style;
            s.height = s.pixelHeight = menu.menuHeight +(menu.menuBorder * 2);
            s.width = s.pixelWidth = menu.menuItemWidth + (menu.menuBorder * 2);
            s.backgroundColor = menu.menuLiteBgColor;

            var body = FIND("menuFg" + x);
            s = body.style;
            s.height = s.pixelHeight = menu.menuHeight + menu.menuBorder;
            s.width = s.pixelWidth = menu.menuItemWidth + menu.menuBorder;
            s.backgroundColor = menu.bgColor;

            s = menuLayer.style;
            s.width = s.pixelWidth  = menu.menuItemWidth + (menu.menuBorder * 4);
            s.height = s.pixelHeight  = menu.menuHeight+(menu.menuBorder*4);
        }
    }
    if (document.captureEvents) {     
        document.captureEvents(Event.MOUSEUP);
    }
    if (document.addEventListener) {     
        document.addEventListener("mouseup", onMenuItemOver, false);
    }
    if (document.layers && window.innerWidth) {
        window.onresize = NS4resize;
        window.NS4sIW = window.innerWidth;
        window.NS4sIH = window.innerHeight;
    }
    document.onmouseup = mouseupMenu;
    window.fwWroteMenu = true;
    status = "";
}

function NS4resize() {
    if (NS4sIW < window.innerWidth ||  
        NS4sIW > window.innerWidth ||  
        NS4sIH > window.innerHeight ||  
        NS4sIH < window.innerHeight )  
    {
        window.location.reload();
    }
}

function onMenuItemOver(e, l) {
    FW_clearTimeout();
    l = l || this;
    a = window.ActiveMenuItem;
    if (document.layers) {
        if (a) {
            a.document.bgColor = a.saveColor;
            if (a.hilite) a.hilite.visibility = "hidden";
            if (a.Menu.bgImageOver) {
                a.background.src = a.Menu.bgImageUp;
            }
            a.focusItem.top = -100;
            a.clicked = false;
        }
        if (l.hilite) {
            l.document.bgColor = l.menuHiliteBgColor;
            l.zIndex = 1;
            l.hilite.visibility = "inherit";
            l.hilite.zIndex = 2;
            l.document.layers[1].zIndex = 1;
            l.focusItem.zIndex = this.zIndex +2;
        }
        if (l.Menu.bgImageOver) {
            l.background.src = l.Menu.bgImageOver;
        }
        l.focusItem.top = this.top;
        l.Menu.hideChildMenu(l);
    } else if (l.style && l.Menu) {
        if (a) {
            a.style.backgroundColor = a.saveColor;
            if (a.hilite) a.hilite.style.visibility = "hidden";
            if (a.Menu.bgImageUp) {
                a.style.background = "url(" + a.Menu.bgImageUp +")";;
            }
        }  
        if (l.isSeparator) return;
        l.style.backgroundColor = l.menuHiliteBgColor;
        l.zIndex = 1;  // magic IE 4.5 mac happy doohicky.    jba
        if (l.Menu.bgImageOver) {
            l.style.background = "url(" + l.Menu.bgImageOver +")";
        }
        if (l.hilite) {
            l.style.backgroundColor = l.menuHiliteBgColor;
            l.hilite.style.visibility = "inherit";
        }
        l.focusItem.style.top = l.focusItem.style.pixelTop = l.style.pixelTop;
        l.focusItem.style.zIndex = l.zIndex +1;
        l.Menu.hideChildMenu(l);
    } else {
        return; // not a menu - magic IE 4.5 mac happy doohicky.  jba
    }
    window.ActiveMenuItem = l;
}

function onMenuItemAction(e, l) {
    l = window.ActiveMenuItem;
    if (!l) return;
    hideActiveMenus();
    if (l.action) {
        eval("" + l.action);
    }
    window.ActiveMenuItem = 0;
}

function FW_clearTimeout()
{
    if (fwHideMenuTimer) clearTimeout(fwHideMenuTimer);
    fwHideMenuTimer = null;
    fwDHFlag = false;
}
function FW_startTimeout()
{
    fwStart = new Date();
    fwDHFlag = true;
    fwHideMenuTimer = setTimeout("fwDoHide()", 1000);
}

function fwDoHide()
{
    if (!fwDHFlag) return;
    var elapsed = new Date() - fwStart;
    if (elapsed < 1000) {
        fwHideMenuTimer = setTimeout("fwDoHide()", 1100-elapsed);
        return;
    }
    fwDHFlag = false;
    hideActiveMenus();
    window.ActiveMenuItem = 0;
}

function FW_showMenu(menu, x, y, child) {
    if (!window.fwWroteMenu) return;
    FW_clearTimeout();
    if (document.layers) {
        if (menu) {
            var l = menu.menuLayer || menu;
            l.left = 1;
            l.top = 1;
            hideActiveMenus();
            if (this.visibility) l = this;
            window.ActiveMenu = l;
        } else {
            var l = child;
        }
        if (!l) return;
        for (var i=0; i<l.layers.length; i++) {                 
            if (!l.layers[i].isHilite)  
                l.layers[i].visibility = "inherit";
            if (l.layers[i].document.layers.length > 0)  
                FW_showMenu(null, "relative", "relative", l.layers[i]);
        }
        if (l.parentLayer) {
            if (x != "relative")  
                l.parentLayer.left = x || window.pageX || 0;
            if (l.parentLayer.left + l.clip.width > window.innerWidth)  
                l.parentLayer.left -= (l.parentLayer.left + l.clip.width - window.innerWidth);
            if (y != "relative")  
                l.parentLayer.top = y || window.pageY || 0;
            if (l.parentLayer.isContainer) {
                l.Menu.xOffset = window.pageXOffset;
                l.Menu.yOffset = window.pageYOffset;
                l.parentLayer.clip.width = window.ActiveMenu.clip.width +2;
                l.parentLayer.clip.height = window.ActiveMenu.clip.height +2;
                if (l.parentLayer.menuContainerBgColor) l.parentLayer.document.bgColor = l.parentLayer.menuContainerBgColor;
            }
        }
        l.visibility = "inherit";
        if (l.Menu) l.Menu.container.visibility = "inherit";
    } else if (FIND("menuItem0")) {
        var l = menu.menuLayer || menu;     
        hideActiveMenus();
        if (typeof(l) == "string") {
            l = FIND(l);
        }
        window.ActiveMenu = l;
        var s = l.style;
        s.visibility = "inherit";
        if (x != "relative")  
            s.left = s.pixelLeft = x || (window.pageX + document.body.scrollLeft) || 0;
        if (y != "relative")  
            s.top = s.pixelTop = y || (window.pageY + document.body.scrollTop) || 0;
        l.Menu.xOffset = document.body.scrollLeft;
        l.Menu.yOffset = document.body.scrollTop;
    }
    if (menu) {
        window.activeMenus[window.activeMenus.length] = l;
    }
}

function onMenuItemDown(e, l) {
    var a = window.ActiveMenuItem;
    if (document.layers) {
        if (a) {
            a.eX = e.pageX;
            a.eY = e.pageY;
            a.clicked = true;
        }
    }
}

function mouseupMenu(e)
{
    hideMenu(true, e);
    hideActiveMenus();
    return true;
}

function mouseoutMenu()
{
    hideMenu(false, false);
    return true;
}

function hideMenu(mouseup, e) {
    var a = window.ActiveMenuItem;
    if (a && document.layers) {
        a.document.bgColor = a.saveColor;
        a.focusItem.top = -30;
        if (a.hilite) a.hilite.visibility = "hidden";
        if (mouseup && a.action && a.clicked && window.ActiveMenu) {
             if (a.eX <= e.pageX+15 && a.eX >= e.pageX-15 && a.eY <= e.pageY+10 && a.eY >= e.pageY-10) {
                setTimeout('window.ActiveMenu.Menu.onMenuItemAction();', 2);
            }
        }
        a.clicked = false;
        if (a.Menu.bgImageOver) {
            a.background.src = a.Menu.bgImageUp;
        }
    } else if (window.ActiveMenu && FIND("menuItem0")) {
        if (a) {
            a.style.backgroundColor = a.saveColor;
            if (a.hilite) a.hilite.style.visibility = "hidden";
            if (a.Menu.bgImageUp) {
                a.style.background = "url(" + a.Menu.bgImageUp +")";;
            }
        }
    }
    if (!mouseup && window.ActiveMenu) {
        if (window.ActiveMenu.Menu) {
            if (window.ActiveMenu.Menu.hideOnMouseOut) {
                FW_startTimeout();
            }
            return(true);
        }
    }
    return(true);
}

function PxToNum(pxStr)
{ // pxStr == 27px, we want 27.
    if (pxStr.length > 2) {
        n = Number(pxStr.substr(0, pxStr.length-2));
        return(n);
    }
    return(0);
}

function hideChildMenu(hcmLayer) {
    FW_clearTimeout();
    var l = hcmLayer;
    for (var i=0; i < l.Menu.childMenus.length; i++) {
        var theLayer = l.Menu.childMenus[i];
        if (document.layers) {
            theLayer.visibility = "hidden";
        } else {
            theLayer = FIND(theLayer);
            theLayer.style.visibility = "hidden";
        }
        theLayer.Menu.hideChildMenu(theLayer);
    }

    if (l.childMenu) {
        var childMenu = l.childMenu;
        if (document.layers) {
            l.Menu.FW_showMenu(null,null,null,childMenu.layers[0]);
            childMenu.zIndex = l.parentLayer.zIndex +1;
            childMenu.top = l.top + l.parentLayer.top + l.Menu.menuLayer.top + l.Menu.menuItemHeight/3;
            if (childMenu.left + childMenu.clip.width > window.innerWidth) {
                childMenu.left = l.parentLayer.left - childMenu.clip.width + l.Menu.menuLayer.left + 15;
                l.Menu.container.clip.left -= childMenu.clip.width;
            } else {
                childMenu.left = l.parentLayer.left + l.parentLayer.clip.width  + l.Menu.menuLayer.left -5;
            }
            var w = childMenu.clip.width+childMenu.left-l.Menu.container.clip.left;
            if (w > l.Menu.container.clip.width)   
                l.Menu.container.clip.width = w;
            var h = childMenu.clip.height+childMenu.top-l.Menu.container.clip.top;
            if (h > l.Menu.container.clip.height) l.Menu.container.clip.height = h;
            l.document.layers[1].zIndex = 0;
            childMenu.visibility = "inherit";
        } else if (FIND("menuItem0")) {
            childMenu = FIND(l.childMenu);
            var menuLayer = FIND(l.Menu.menuLayer);
            var s = childMenu.style;
            s.zIndex = menuLayer.style.zIndex+1;
            if (document.all) { // ie case.
                s.pixelTop = l.style.pixelTop + menuLayer.style.pixelTop + l.Menu.menuItemHeight/3;
                s.left = s.pixelLeft = (menuLayer.style.pixelWidth) + menuLayer.style.pixelLeft -5;
            } else { // zilla case
                var top = PxToNum(l.style.top) + PxToNum(menuLayer.style.top) + l.Menu.menuItemHeight/3;
                var left = (PxToNum(menuLayer.style.width)) + PxToNum(menuLayer.style.left) -5;
                s.top = top;
                s.left = left;
            }
            childMenu.style.visibility = "inherit";
        } else {
            return;
        }
        window.activeMenus[window.activeMenus.length] = childMenu;
    }
}

function hideActiveMenus() {
    if (!window.activeMenus) return;
    for (var i=0; i < window.activeMenus.length; i++) {
        if (!activeMenus[i]) continue;
        if (activeMenus[i].visibility && activeMenus[i].Menu) {
            activeMenus[i].visibility = "hidden";
            activeMenus[i].Menu.container.visibility = "hidden";
            activeMenus[i].Menu.container.clip.left = 0;
        } else if (activeMenus[i].style) {
            var s = activeMenus[i].style;
            s.visibility = "hidden";
            s.left = -200;
            s.top = -200;
        }
    }
    if (window.ActiveMenuItem) {
        hideMenu(false, false);
    }
    window.activeMenus.length = 0;

PHP 相关文章推荐
配置PHP使之能同时支持GIF和JPEG
Oct 09 PHP
php下mysql数据库操作类(改自discuz)
Jul 03 PHP
php中关于codeigniter的xmlrpc的类在进行数据交换时的类型问题
Jul 03 PHP
php 多关键字 高亮显示实现代码
Apr 23 PHP
php中in_array函数用法探究
Nov 25 PHP
PHP通过API获取手机号码归属地
May 28 PHP
再Docker中架设完整的WordPress站点全攻略
Jul 29 PHP
用HTML/JS/PHP方式实现页面延时跳转的简单实例
Jul 18 PHP
Yii框架弹出框功能示例
Jan 07 PHP
PHP面向对象多态性实现方法简单示例
Sep 27 PHP
PHP设计模式之数据访问对象模式(DAO)原理与用法实例分析
Dec 12 PHP
用PHP4访问Oracle815
Oct 09 #PHP
PHP怎样调用MSSQL的存储过程
Oct 09 #PHP
BBS(php &amp; mysql)完整版(五)
Oct 09 #PHP
BBS(php &amp; mysql)完整版(七)
Oct 09 #PHP
用PHP实现小型站点广告管理(修正版)
Oct 09 #PHP
BBS(php &amp; mysql)完整版(二)
Oct 09 #PHP
BBS(php &amp; mysql)完整版(三)
Oct 09 #PHP
You might like
CodeIgniter配置之config.php用法实例分析
2016/01/19 PHP
PHP设计模式之装饰器模式实例详解
2018/02/07 PHP
Code:findPosX 和 findPosY
2006/12/20 Javascript
网页前台通过js非法字符过滤代码(骂人的话等等)
2010/05/26 Javascript
javascript 获取函数形参个数
2014/07/31 Javascript
nodejs开发微博实例
2015/03/25 NodeJs
javascript+HTML5 Canvas绘制转盘抽奖
2020/05/16 Javascript
Avalonjs 实现简单购物车功能(实例代码)
2017/02/07 Javascript
Async Validator 异步验证使用说明
2017/07/03 Javascript
JavaScript中in和hasOwnProperty区别详解
2017/08/04 Javascript
JavaScript基础之流程控制语句的用法
2017/08/31 Javascript
对vue v-if v-else-if v-else 的简单使用详解
2018/09/29 Javascript
NodeJS使用Range请求实现下载功能的方法示例
2018/10/12 NodeJs
如何解决日期函数new Date()浏览器兼容性问题
2019/09/11 Javascript
Python中的is和id用法分析
2015/01/26 Python
python爬虫的工作原理
2017/03/05 Python
在python中bool函数的取值方法
2018/11/01 Python
python3.7 sys模块的具体使用
2019/07/22 Python
django组合搜索实现过程详解(附代码)
2019/08/06 Python
Pycharm远程调试原理及具体配置详解
2019/08/08 Python
使用Python代码实现Linux中的ls遍历目录命令的实例代码
2019/09/07 Python
一文带你了解Python 四种常见基础爬虫方法介绍
2020/12/04 Python
基于pycharm 项目和项目文件命名规则的介绍
2021/01/15 Python
运动鞋中的劳斯莱斯:索康尼(SAUCONY)
2017/08/09 全球购物
联想新西兰官方网站:Lenovo New Zealand
2018/10/30 全球购物
大学生学业生涯规划
2014/01/05 职场文书
结婚典礼证婚词
2014/01/11 职场文书
广告业务员岗位职责
2014/02/06 职场文书
企业负责人任命书
2014/06/05 职场文书
超市创意活动方案
2014/08/15 职场文书
党员对照检查材料整改措施思想汇报
2014/09/26 职场文书
庆六一宣传标语
2014/10/08 职场文书
2014年初中班主任工作总结
2014/11/08 职场文书
Go Gin实现文件上传下载的示例代码
2021/04/02 Golang
asyncio异步编程之Task对象详解
2022/03/13 Python
Python代码实现双链表
2022/05/25 Python