欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-08-11 16:04:16
//下面为menu_comment.js function fwloadmenus() {   if (window.fw_menu_0) return...
//下面为menu_comment.js
function fwloadmenus() {
  if (window.fw_menu_0) return;
  window.fw_menu_0 = new menu("root",92,20,"verdana, arial, helvetica, sans-serif",12,"#6666ff","#ffffff","#ff9999","#6666ff");
  fw_menu_0.addmenuitem("javascript","window.open('left.php', '_self');");
  fw_menu_0.addmenuitem("css快速入门","window.open('left.php', '_self');");
  fw_menu_0.addmenuitem("js在线资源","window.open('left.php', '_self');");
  fw_menu_0.addmenuitem("相关论坛","window.open('php3.php?part=4&&p=1', '_self');");
  fw_menu_0.fontweight="solid";
   fw_menu_0.hideonmouseout=true;
  window.fw_menu_1 = new menu("root",92,20,"verdana, arial, helvetica, sans-serif",12,"#6666ff","#ffffff","#ff9999","#6666ff");
  fw_menu_1.addmenuitem("dreamwaver","window.open('left.php', '_self');");
  fw_menu_1.addmenuitem("firework","window.open('left.php', '_self');");
  fw_menu_1.addmenuitem("flash入门","window.open('left.php', '_self');");
  fw_menu_1.addmenuitem("html教程","window.open('left.php', '_self');");
  fw_menu_1.addmenuitem("相关论坛","window.open('php3.php?part=3&&p=1', '_self');");
  fw_menu_1.fontweight="solid";
   fw_menu_1.hideonmouseout=true;
   window.fw_menu_2 = new menu("root",86,20,"verdana, arial, helvetica, sans-serif",12,"#6666ff","#ffffff","#ff9999","#6666ff");
  fw_menu_2.addmenuitem("mysql介绍","window.open('mysql1.php', '_self');");
  fw_menu_2.addmenuitem("在线下载","window.open('mysql2.php', '_self');");
  fw_menu_2.addmenuitem("学习教程","window.open('mysql4a.php', '_self');");
   fw_menu_2.addmenuitem("mysql论坛","window.open('php3.php?part=2&&p=1', '_self');");
   fw_menu_2.fontweight="solid";
   fw_menu_2.hideonmouseout=true;
  window.fw_menu_3 = new menu("root",76,20,"verdana, arial, helvetica, sans-serif",12,"#6666ff","#ffffff","#ff9999","#6666ff");
  fw_menu_3.addmenuitem("安装配置","window.open('php1.php?id1=1&&id2=1', '_self');");
  fw_menu_3.addmenuitem("程序代码","window.open('php2.php?id1=2&&id2=1', '_self');");
  fw_menu_3.addmenuitem("学习教程","window.open('php4.php?id1=4&&id2=1', '_self');");
   fw_menu_3.addmenuitem("php论坛","window.open('php3.php?part=1&&p=1', '_self');");
   fw_menu_3.fontweight="solid";
   fw_menu_3.hideonmouseout=true;

  fw_menu_3.writemenus();
} // fwloadmenus()
//下面是fw_menu.js
function menu(label, mw, mh, fnt, fs, fclr, fhclr, bg, bgh) {
    this.version = "990702 [menu; menu.js]";
    this.type = "menu";
    this.menuwidth = mw;
    this.menuitemheight = mh;
    this.fontsize = fs||12;
    this.fontweight = "plain";
    this.fontfamily = fnt||"arial,helvetica,verdana,sans-serif";
    this.fontcolor = fclr||"#000000";
    this.fontcolorhilite = fhclr||"#ffffff";
    this.bgcolor = "#555555";
    this.menuborder = 1;
    this.menuitemborder = 1;
    this.menuitembgcolor = bg||"#cccccc";
    this.menulitebgcolor = "#ffffff";
    this.menuborderbgcolor = "#777777";
    this.menuhilitebgcolor = bgh||"#000084";
    this.menucontainerbgcolor = "#cccccc";
    this.childmenuicon = "arrows.gif";
    this.items = new array();
    this.actions = new array();
    this.childmenus = new array();

    this.hideonmouseout = true;

    this.addmenuitem = addmenuitem;
    this.addmenuseparator = addmenuseparator;
    this.writemenus = writemenus;
    this.fw_showmenu = fw_showmenu;
    this.onmenuitemover = onmenuitemover;
    this.onmenuitemaction = onmenuitemaction;
    this.hidemenu = hidemenu;
    this.hidechildmenu = hidechildmenu;

    if (!window.menus) window.menus = new array();
    this.label = label || "menulabel" + window.menus.length;
    window.menus[this.label] = this;
    window.menus[window.menus.length] = this;
    if (!window.activemenus) window.activemenus = new array();
}

function addmenuitem(label, action) {
    this.items[this.items.length] = label;
    this.actions[this.actions.length] = action;
}
function addmenuseparator() {
    this.items[this.items.length] = "separator";
    this.actions[this.actions.length] = "";
    this.menuitemborder = 0;
}
// for ns6.  
function find(item) {
    if (document.all) return(document.all[item]);
    if (document.getelementbyid) return(document.getelementbyid(item));
    return(false);
}

function writemenus(container) {
    if (window.triedtowritemenus) return;

    if (!container && document.layers) {
        window.delaywritemenus = this.writemenus;
        var timer = settimeout('delaywritemenus()', 250);
        container = new layer(100);
        cleartimeout(timer);
    } else if (document.all || document.haschildnodes) {
        document.writeln('<span id="menucontainer"></span>');
        container = find("menucontainer");
    }

    window.fwhidemenutimer = null;
    if (!container) return;     
    window.triedtowritemenus = true;  
    container.iscontainer = true;
    container.menus = new array();
    for (var i=0; i<window.menus.length; i++)  
        container.menus[i] = window.menus[i];
    window.menus.length = 0;
    var countmenus = 0;
    var countitems = 0;
    var top = 0;
    var content = '';
    var lrs = false;
    var thestat = "";
    var tsc = 0;
    if (document.layers) lrs = true;
    for (var i=0; i<container.menus.length; i++, countmenus++) {
        var menu = container.menus[i];
        if (menu.bgimageup) {
            menu.menuborder = 0;
            menu.menuitemborder = 0;
        }
        if (lrs) {
            var menulayer = new layer(100, container);
            var lite = new layer(100, menulayer);
            lite.top = menu.menuborder;
            lite.left = menu.menuborder;
            var body = new layer(100, lite);
            body.top = menu.menuborder;
            body.left = menu.menuborder;
        } else {
            content += ''+
            '<div id="menulayer'+ countmenus +'" style="position:absolute;z-index:1;left:10;top:'+ (i * 100) +';visibility:hidden;">n'+
            '  <div id="menulite'+ countmenus +'" style="position:absolute;z-index:1;left:'+ menu.menuborder +';top:'+ menu.menuborder +';visibility:hide;" onmouseout="mouseoutmenu();">n'+
            '     <div id="menufg'+ countmenus +'" style="position:absolute;left:'+ menu.menuborder +';top:'+ menu.menuborder +';visibility:hide;">n'+
            '';
        }
        var x=i;
        for (var i=0; i<menu.items.length; i++) {
            var item = menu.items[i];
            var childmenu = false;
            var defaultheight = menu.fontsize+6;
            var defaultindent = menu.fontsize;
            if (item.label) {
                item = item.label;
                childmenu = true;
            }
            menu.menuitemheight = menu.menuitemheight || defaultheight;
            menu.menuitemindent = menu.menuitemindent || defaultindent;
            var itemprops = 'font-family:' + menu.fontfamily +';font-weight:' + menu.fontweight + ';fontsize:' + menu.fontsize + ';';
            if (menu.fontstyle) itemprops += 'font-style:' + menu.fontstyle + ';';
            if (document.all)  
                itemprops += 'font-size:' + menu.fontsize + ';" onmouseover="onmenuitemover(null,this);" onclick="onmenuitemaction(null,this);';
            else if (!document.layers) {
                itemprops += 'font-size:' + menu.fontsize + 'px;'; // zilla wants 12px.
            }
            var l;
            if (lrs) {
                l = new layer(800,body);
            }
            var dtag    = '<div id="menuitem'+ countitems +'" style="position:absolute;left:0;top:'+ (i * menu.menuitemheight) +';'+ itemprops +'">';
            var dclose = '</div>'
            if (menu.bgimageup) {
                menu.menuborder = 0;
                menu.menuitemborder = 0;
                dtag    = '<div id="menuitem'+ countitems +'" style="background:url('+menu.bgimageup+');position:absolute;left:0;top:'+ (i * menu.menuitemheight) +';'+ itemprops +'">';
                if (document.layers) {
                    dtag = '<layer background="'+menu.bgimageup+'" id="menuitem'+ countitems +'" top="'+ (i * menu.menuitemheight) +'" style="' + itemprops +'">';
                    dclose = '</layer>';
                }
            }
            var textprops = 'position:absolute;left:' + menu.menuitemindent + ';top:1;';
            if (lrs) {
                textprops +=itemprops;
                dtag = "";
                dclose = "";
            }

            var dtext    = '<div id="menuitemtext'+ countitems +'" style="' + textprops + 'color:'+ menu.fontcolor +';">'+ item +'&nbsp</div>n<div id="menuitemhilite'+ countitems +'" style="' + textprops + 'top:1;color:'+ menu.fontcolorhilite +';visibility:hidden;">'+ item +'&nbsp</div>';
            if (item == "separator") {
                content += ( dtag + '<div id="menuseparator'+ countitems +'" style="position:absolute;left:1;top:2;"></div>n<div id="menuseparatorlite'+ countitems +'" style="position:absolute;left:1;top:2;"></div>n' + dclose);
            } else if (childmenu) {
                content += ( dtag + dtext + '<div id="childmenu'+ countitems +'" style="position:absolute;left:0;top:3;"><img src="'+ menu.childmenuicon +'"></div>n' + dclose);
            } else {
                content += ( dtag + dtext + dclose);
            }
            if (lrs) {
                l.document.open("text/html");
                l.document.writeln(content);
                l.document.close();     
                content = '';
                thestat += "-";
                tsc++;
                if (tsc > 50) {
                    tsc = 0;
                    thestat = "";
                }
                status = thestat;
            }
            countitems++;   
        }
        if (lrs) {
            // focus layer
            var focusitem = new layer(100, body);
            focusitem.visiblity="hidden";
            focusitem.document.open("text/html");
            focusitem.document.writeln(" ");
            focusitem.document.close();     
        } else {
          content += '      <div id="focusitem'+ countmenus +'" style="position:absolute;left:0;top:0;visibility:hide;" onclick="onmenuitemaction(null,this);"> </div>n';
          content += '   </div>n  </div>n</div>n';
        }
        i=x;
    }
    if (document.layers) {         
        container.clip.width = window.innerwidth;
        container.clip.height = window.innerheight;
        container.onmouseout = mouseoutmenu;
        container.menucontainerbgcolor = this.menucontainerbgcolor;
        for (var i=0; i<container.document.layers.length; i++) {
            proto = container.menus[i];
            var menu = container.document.layers[i];
            container.menus[i].menulayer = menu;
            container.menus[i].menulayer.menu = container.menus[i];
            container.menus[i].menulayer.menu.container = container;
            var body = menu.document.layers[0].document.layers[0];
            body.clip.width = proto.menuwidth || body.clip.width;
            body.clip.height = proto.menuheight || body.clip.height;
            for (var n=0; n<body.document.layers.length-1; n++) {
                var l = body.document.layers[n];
                l.menu = container.menus[i];
                l.menuhilitebgcolor = proto.menuhilitebgcolor;
                l.document.bgcolor = proto.menuitembgcolor;
                l.savecolor = proto.menuitembgcolor;
                l.onmouseover = proto.onmenuitemover;
                l.onclick = proto.onmenuitemaction;
                l.action = container.menus[i].actions[n];
                l.focusitem = body.document.layers[body.document.layers.length-1];
                l.clip.width = proto.menuwidth || body.clip.width + proto.menuitemindent;
                l.clip.height = proto.menuitemheight || l.clip.height;
                if (n>0) l.top = body.document.layers[n-1].top + body.document.layers[n-1].clip.height + proto.menuitemborder;
                l.hilite = l.document.layers[1];
                if (proto.bgimageup) l.background.src = proto.bgimageup;
                l.document.layers[1].ishilite = true;
                if (l.document.layers[0].id.indexof("menuseparator") != -1) {
                    l.hilite = null;
                    l.clip.height -= l.clip.height / 2;
                    l.document.layers[0].document.bgcolor = proto.bgcolor;
                    l.document.layers[0].clip.width = l.clip.width -2;
                    l.document.layers[0].clip.height = 1;
                    l.document.layers[1].document.bgcolor = proto.menulitebgcolor;
                    l.document.layers[1].clip.width = l.clip.width -2;
                    l.document.layers[1].clip.height = 1;
                    l.document.layers[1].top = l.document.layers[0].top + 1;
                } else if (l.document.layers.length > 2) {
                    l.childmenu = container.menus[i].items[n].menulayer;
                    l.document.layers[2].left = l.clip.width -13;
                    l.document.layers[2].top = (l.clip.height / 2) -4;
                    l.document.layers[2].clip.left += 3;
                    l.menu.childmenus[l.menu.childmenus.length] = l.childmenu;
                }
            }
            body.document.bgcolor = proto.bgcolor;
            body.clip.width  = l.clip.width +proto.menuborder;
            body.clip.height = l.top + l.clip.height