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中全局变量global的使用演示代码
May 18 PHP
PHP 获取文件路径(灵活应用__FILE__)
Feb 15 PHP
解决phpmyadmin中缺少mysqli扩展问题的方法
May 06 PHP
基于PHP array数组的教程详解
Jun 05 PHP
PHP的PSR规范中文版
Sep 28 PHP
php的memcache类分享(memcache队列)
Mar 26 PHP
php使用ereg验证文件上传的方法
Dec 16 PHP
简单谈谈php浮点数精确运算
Mar 10 PHP
ThinkPHP实现简单登陆功能
Apr 28 PHP
详解php框架Yaf路由重写
Jun 20 PHP
PHP+MariaDB数据库操作基本技巧备忘总结
May 21 PHP
PHP基于curl模拟post提交json数据示例
Jun 22 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
Syphon 虹吸式咖啡壶冲煮–拨动法
2021/03/03 冲泡冲煮
WINDOWS服务器安装多套PHP的另类解决方案
2006/10/09 PHP
深入php 正则表达式的学习探讨
2013/06/06 PHP
探讨PHP中this,self,parent的区别详解
2013/06/08 PHP
关于php程序报date()警告的处理(date_default_timezone_set)
2013/10/22 PHP
PHP在同一域名下两个不同的项目做独立登录机制详解
2017/09/22 PHP
动态添加js事件实现代码
2009/03/12 Javascript
用JavaScript页面不刷新时全选择,全删除(GridView)
2009/04/14 Javascript
jquery json 实例代码
2010/12/02 Javascript
nodejs 后缀名判断限制代码
2011/03/31 NodeJs
Js(JavaScript)中,弹出是或否的选择框示例(confirm用法的实例分析)
2013/07/09 Javascript
jQuery中next方法用法实例
2015/04/24 Javascript
JS生成和下载二维码的代码
2016/12/07 Javascript
详解js中==与===的区别
2017/01/08 Javascript
详解如何在Vue2中实现组件props双向绑定
2017/03/29 Javascript
基于nodejs实现微信支付功能
2017/12/20 NodeJs
vue2实现搜索结果中的搜索关键字高亮的代码
2018/08/29 Javascript
vue-cli 目录结构详细讲解总结
2019/01/15 Javascript
bootstrap-treeview实现多级树形菜单 后台JSON格式如何组织?
2019/07/26 Javascript
JavaScript 作用域实例分析
2019/10/02 Javascript
Node使用Nodemailer发送邮件的方法实现
2020/02/24 Javascript
[00:12]2018DOTA2亚洲邀请赛 sylar表现SOLO技艺
2018/04/06 DOTA
Android 兼容性问题:java.lang.UnsupportedOperationException解决办法
2017/03/19 Python
Python判断两个文件是否相同与两个文本进行相同项筛选的方法
2019/03/01 Python
Python绘制二维曲线的日常应用详解
2019/12/04 Python
Python根据URL地址下载文件并保存至对应目录的实现
2020/11/15 Python
任意一块网页内容实现“活”的背景(目前火狐浏览器专有)
2014/05/07 HTML / CSS
美国在线旅行社:Crystal Travel
2018/09/11 全球购物
美体小铺奥地利官方网站:The Body Shop奥地利
2019/04/11 全球购物
意大利买卖二手奢侈品网站:LAMPOO
2020/06/03 全球购物
会计大学生职业生涯规划书范文
2014/01/13 职场文书
大学校运会广播稿
2014/02/03 职场文书
上班玩手机检讨书
2014/02/17 职场文书
网络编辑求职信
2014/04/30 职场文书
青春飞扬演讲稿
2014/09/11 职场文书
教你怎么用python爬取爱奇艺热门电影
2021/05/20 Python