下拉式選單?

Home Home
引用 | 編輯 detecti41258
2005-08-08 11:35
樓主
推文 x0
【類型】其他
【版本】1.3.6

請問怎麼製作下拉式選單,我有試過1.3.6專用的下拉式選單,但common.js會錯誤。

關於以下的代碼換成別的代碼會錯誤!
<body vlink=333333 link=333333 alink=333333 leftmargin=Ɔ' rightmargin=Ɔ' topmargin=Ɔ' bottommargin=Ɔ'>
替換為
<body vlink=333333 link=333333 alink=333333 leftmargin="0" rightmargin=Ɔ' topmargin="0" bottommargin=Ɔ' marginwidth="0" marginheight="0" onmousemove=HideMenu();>
<script language="JavaScript" src="require/common.js"></script>
<div id=menuDiv style="visibility: hidden; width: 0px; position: absolute; height: 0px"></div>


以下是common.js的內容! (幫我看看哪裡有錯誤)複製程式
/******************************************************************************
  Crossday Discuz! Board - Common Modules for Discuz!
  Modified by: Crossday Studio ([url]http://crossday.com[/url])
  Based upon:  [url]http://www.cnzzz.com[/url]
*******************************************************************************/

tPopWait=30;
showPopStep=20;
popOpacity=80;

sPop=null;
curShow=null;
tFadeOut=null;
tFadeIn=null;
tFadeWaiting=null;

document.write("<style type='text/css'id='defaultPopStyle'>");
document.write(".cPopText { font-family: Verdana, Tahoma; background-color: #DDEEFF; border: 1px #666666 solid; font-size: 11px; padding-right: 6px; padding-left: 6px; Height: 20px; padding-top: 4px; padding-bottom: 3px; filter: Alpha(Opacity=0)}");

document.write("</style>");
document.write("<div id='popLayer' style='position:absolute;z-index:1000;' class='cPopText'></div>");


function showPopupText(){
       var o=event.srcElement;
       MouseX=event.x;
       MouseY=event.y;
       if(o.alt!=null && o.alt!="") { o.pop=o.alt;o.alt="" }
        if(o.title!=null && o.title!=""){ o.pop=o.title;o.title="" }
        if(o.pop) { o.pop=o.pop.replace("\n","<br>"); o.pop=o.pop.replace("\n","<br>"); }
       if(o.pop!=sPop) {
              sPop=o.pop;
              clearTimeout(curShow);
              clearTimeout(tFadeOut);
              clearTimeout(tFadeIn);
              clearTimeout(tFadeWaiting);       
              if(sPop==null || sPop=="") {
                     popLayer.innerHTML="";
                     popLayer.style.filter="Alpha()";
                     popLayer.filters.Alpha.opacity=0;       
              } else {
                     if(o.dyclass!=null) popStyle=o.dyclass 
                     else popStyle="cPopText";
                     curShow=setTimeout("showIt()",tPopWait);
              }
       }
}

function showIt() {
       popLayer.className=popStyle;
       popLayer.innerHTML=sPop;
       popWidth=popLayer.clientWidth;
       popHeight=popLayer.clientHeight;
       if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24
              else popLeftAdjust=0;
       if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24
              else popTopAdjust=0;
       popLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;
       popLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;
       popLayer.style.filter="Alpha(Opacity=0)";
       fadeOut();
}

function fadeOut(){
       if(popLayer.filters.Alpha.opacity<popOpacity) {
              popLayer.filters.Alpha.opacity+=showPopStep;
              tFadeOut=setTimeout("fadeOut()",1);
       }
}

function ctlent(obj) {
       if((event.ctrlKey && window.event.keyCode == 13) || (event.altKey && window.event.keyCode == 83)) {
              if ((this.document.input.postcopy) && (this.document.input.postcopy.checked == true)) 
{ 
var tempval=eval(this.document.input.message) 
tempval.focus(); 
tempval.select(); 
therange=tempval.createTextRange(); 
therange.execCommand("Copy"); 
} 
              //if(validate(this.document.input)) 
              this.document.input.submit();
       }
}

function checkall(form) {
       for(var i = 0;i < form.elements.length; i++) {
              var e = form.elements[i];
              if (e.name != 'chkall') {
                     e.checked = form.chkall.checked;
              }
       }
}

function findobj(n, d) {
       var p,i,x; if(!d) d=document;
       if((p=n.indexOf("?"))>0 && parent.frames.length) {
              d=parent.frames[n.substring(p+1)].document;
              n=n.substring(0,p);
       }
       if(!(x=d[n])&&d.all) {
              x=d.all[n];
       }
       for(i=0;!x && i<d.forms.length;i++) {
              x=d.forms[i][n];
       }
       for(i=0;!x && d.layers&&i>d.layers.length;i++) {
              x=MM_findObj(n,d.layers[i].document);
       }
       return x;
}

function copycode(obj) {
       var rng = document.body.createTextRange();
       rng.moveToElementText(obj);
       rng.scrollIntoView();
       rng.select();
       rng.execCommand("Copy");
       rng.collapse(false);
}
document.onmouseover=showPopupText;
<!-- 
var h;
var l;
var t;
var isvisible;
function HideMenu() 
{
var mX;
var mY;
var vDiv;
    if (isvisible == true)
{
        vDiv = document.all("menuDiv");
        mX = window.event.clientX + document.body.scrollLeft;
        mY = window.event.clientY + document.body.scrollTop;
        if ((mX < parseInt(vDiv.style.left)) || (mX > parseInt(vDiv.style.left)+vDiv.offsetWidth) || (mY < parseInt(vDiv.style.top)-h) || (mY > parseInt(vDiv.style.top)+vDiv.offsetHeight)){
            vDiv.style.visibility = "hidden";
            isvisible = false;
        }
    }
}

function ShowMenu(vMnuCode) {
    vSrc = window.event.srcElement;
    vMnuCode = "<DIV style='PADDING-RIGHT: 6px; FILTER: shadow(color=#5F5F5F,direction=120); PADDING-BOTTOM: 6px;width:98px'><table border=0 cellspacing=1 cellpadding=4 bgcolor=#76AE00 style='line-height:18px' width=ྞ' align='left'><tr bgcolor='#FFFFFF'><td width=14 background=images/menubg.gif> </td><td>" + vMnuCode + "</td></tr></table></div>";
    h = vSrc.offsetHeight + 0;
    l = vSrc.offsetLeft + 0;
    t = vSrc.offsetTop + h;
    vParent = vSrc.offsetParent;
    while (vParent.tagName.toUpperCase() != "BODY")
    {
        l += vParent.offsetLeft;
        t += vParent.offsetTop;
        vParent = vParent.offsetParent;
    }

    menuDiv.innerHTML = vMnuCode;
    menuDiv.style.top = t;
    menuDiv.style.left = l;
    menuDiv.style.visibility = "visible";
    isvisible = true;
    
}

//-->


PS:請勿發表筆戰的回文

獻花 x0
引用 | 編輯 達人村惟祿
2005-08-08 12:35
1樓
  
你發生的錯誤是如何

1.網頁發生錯誤
2.下拉選單沒有出現

獻花 x0
引用 | 編輯 detecti41258
2005-08-08 12:41
2樓
  
下面是引用晨秋於2005-08-8 12:35發表的 :
你發生的錯誤是如何

1.網頁發生錯誤
2.下拉選單沒有出現

是網頁發生錯誤,目前已知是common.js的問題。

因為common.js是由Discuz插件轉換過來的,應該是沒有修改好。

獻花 x1
引用 | 編輯 達人村惟祿
2005-08-08 12:47
3樓
  
試試看這個common.js
複製程式
tPopWait=30;
showPopStep=20;
popOpacity=80;

sPop=null;
curShow=null;
tFadeOut=null;
tFadeIn=null;
tFadeWaiting=null;

document.write("<style type='text/css'id='defaultPopStyle'>");
document.write(".cPopText { font-family: Verdana, Tahoma; background-color: #DDEEFF; border: 1px #666666 solid; font-size: 11px; padding-right: 6px; padding-left: 6px; Height: 20px; padding-top: 4px; padding-bottom: 3px; filter: Alpha(Opacity=0)}");

document.write("</style>");
document.write("<div id='popLayer' style='position:absolute;z-index:1000;' class='cPopText'></div>");


function showPopupText(){
       var o=event.srcElement;
       MouseX=event.x;
       MouseY=event.y;
       if(o.alt!=null && o.alt!="") { o.pop=o.alt;o.alt="" }
        if(o.title!=null && o.title!=""){ o.pop=o.title;o.title="" }
        if(o.pop) { o.pop=o.pop.replace("\n","<br>"); o.pop=o.pop.replace("\n","<br>"); }
       if(o.pop!=sPop) {
              sPop=o.pop;
              clearTimeout(curShow);
              clearTimeout(tFadeOut);
              clearTimeout(tFadeIn);
              clearTimeout(tFadeWaiting);       
              if(sPop==null || sPop=="") {
                     popLayer.innerHTML="";
                     popLayer.style.filter="Alpha()";
                     popLayer.filters.Alpha.opacity=0;       
              } else {
                     if(o.dyclass!=null) popStyle=o.dyclass 
                     else popStyle="cPopText";
                     curShow=setTimeout("showIt()",tPopWait);
              }
       }
}

function showIt() {
       popLayer.className=popStyle;
       popLayer.innerHTML=sPop;
       popWidth=popLayer.clientWidth;
       popHeight=popLayer.clientHeight;
       if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24
              else popLeftAdjust=0;
       if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24
              else popTopAdjust=0;
       popLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;
       popLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;
       popLayer.style.filter="Alpha(Opacity=0)";
       fadeOut();
}

function fadeOut(){
       if(popLayer.filters.Alpha.opacity<popOpacity) {
              popLayer.filters.Alpha.opacity+=showPopStep;
              tFadeOut=setTimeout("fadeOut()",1);
       }
}

function ctlent(obj) {
       if((event.ctrlKey && window.event.keyCode == 13) || (event.altKey && window.event.keyCode == 83)) {
              if ((this.document.input.postcopy) && (this.document.input.postcopy.checked == true)) 
{ 
var tempval=eval(this.document.input.message) 
tempval.focus(); 
tempval.select(); 
therange=tempval.createTextRange(); 
therange.execCommand("Copy"); 
} 
              //if(validate(this.document.input)) 
              this.document.input.submit();
       }
}

function checkall(form) {
       for(var i = 0;i < form.elements.length; i++) {
              var e = form.elements[i];
              if (e.name != 'chkall') {
                     e.checked = form.chkall.checked;
              }
       }
}

function findobj(n, d) {
       var p,i,x; if(!d) d=document;
       if((p=n.indexOf("?"))>0 && parent.frames.length) {
              d=parent.frames[n.substring(p+1)].document;
              n=n.substring(0,p);
       }
       if(!(x=d[n])&&d.all) {
              x=d.all[n];
       }
       for(i=0;!x && i<d.forms.length;i++) {
              x=d.forms[i][n];
       }
       for(i=0;!x && d.layers&&i>d.layers.length;i++) {
              x=MM_findObj(n,d.layers[i].document);
       }
       return x;
}

function copycode(obj) {
       var rng = document.body.createTextRange();
       rng.moveToElementText(obj);
       rng.scrollIntoView();
       rng.select();
       rng.execCommand("Copy");
       rng.collapse(false);
}
<!-- 
var h;
var l;
var t;
var isvisible;
function HideMenu() 
{
var mX;
var mY;
var vDiv;
    if (isvisible == true)
{
        vDiv = document.all("menuDiv");
        mX = window.event.clientX + document.body.scrollLeft;//檢索到鼠標移動到的X坐標+橫向滾動條位置
        mY = window.event.clientY + document.body.scrollTop;//檢索到鼠標移動到的Y坐標+縱向滾動條位置
        if ((mX < parseInt(vDiv.style.left)) || (mX > parseInt(vDiv.style.left)+vDiv.offsetWidth) || (mY < parseInt(vDiv.style.top)-h) || (mY > parseInt(vDiv.style.top)+vDiv.offsetHeight)){//簡單的說法就是比較鼠標坐標值與子菜單坐標值
            vDiv.style.visibility = "hidden";//只要滿足以上任一條件,子菜單就隱藏
            isvisible = false;//返回一個布爾值后結束
        }
    }
}

function ShowMenu(vMnuCode) {
    vSrc = window.event.srcElement;//檢索事件的對象,在這里就是檢索到鼠標移到對象上而找到主菜單元素
    vMnuCode = "<DIV style='PADDING-RIGHT: 6px; FILTER: shadow(color=#CCCCCC,direction=120); PADDING-BOTTOM: 6px;width:98px'><table border=0 cellspacing=1 cellpadding=4 bgcolor=#698CC3 style='line-height:18px' width=ྞ' align='left'><tr bgcolor='#ffffff'><td>" + vMnuCode + "</td></tr></table></div>";//得到子菜單的HTML文本,在這里可以定義子菜單的外觀
    h = vSrc.offsetHeight + 4;//主菜單本身高度+主菜單元素本身高度+4,可以通過調整此數字控制主菜單和子菜單的間距,此值很重要,因為在HideMenu()中要調用,如果不要此值,就不能在t后面添加,否則會使菜單顯示不正常
    l = vSrc.offsetLeft + 0;//主菜單的X坐標-10,可以通過調整此數字控制主菜單和子菜單的縮進
    t = vSrc.offsetTop + h;//主菜單的Y坐標
    vParent = vSrc.offsetParent;//定義元素的坐標系統
    while (vParent.tagName.toUpperCase() != "BODY")//在vParent元素的標記符是大寫BODY之前循環,因為在后面設置innerHTML屬性時,不能在文檔加載時設置
    {
        l += vParent.offsetLeft;//+=左運算數加右運算數,和賦值給左運算數
        t += vParent.offsetTop;
        vParent = vParent.offsetParent;//重新定義元素的坐標系統
    }

    menuDiv.innerHTML = vMnuCode;//interHTML:元素包含的HTML文本。可以用指定的HTML文本替換元素的內容,在這里就是利用它把子菜單的HTML文本加入menuDIV對象的標記符內。
    menuDiv.style.top = t;//設置top值
    menuDiv.style.left = l;//設置left值
    menuDiv.style.visibility = "visible";//設置顯示
    isvisible = true;//返回一個布魯值,以便HideMenu()調用
    
}
//--> 
document.onmouseover=showPopupText;


獻花 x1
引用 | 編輯 達人村惟祿
2005-08-08 12:51
4樓
  
如果是 其他版本

要在header頂部加以下代碼:

<script language="JavaScript" src="require/common.js"></script>

獻花 x0
引用 | 編輯 detecti41258
2005-08-08 13:07
5樓
  
還不能使用,以下的代碼也有問題,換上去之後出現亂碼。

一般選單增加法:
舉例:
在 header.htm 的統計設定下拉菜單
$list1="<a href=\"\" onmouseover=\"ShowMenu('<a href=stats.php?type=week>星期流量</a><br><a href=stats.php?type=hour>時段流量</a><br><a href=stats.php?type=agent>客戶軟體</a><br><a href=stats.php?type=threads>主題排行</a><br><a href=stats.php?type=member>會員排行</a>')\">論壇統計</a>";

獻花 x0
引用 | 編輯 達人村惟祿
2005-08-08 13:57
6樓
  
在header頂部加以下代碼:

<script language="JavaScript" src="require/common.js"></script>

找到:

<body vlink='#333333' link='#333333'>

替換成:

<body vlink='#333333' link='#333333' leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onmousemove=HideMenu();><div id=menuDiv style="visibility: hidden; width: 0px; position: absolute; height: 0px"></div>

獻花 x0
引用 | 編輯 達人村惟祿
2005-08-08 14:13
7樓
  
以下是 替換範例

| <a href=profile.php class=table>控制面板</a>

替換成:

| <a href="profile.php" class=table onmouseover="ShowMenu('<a href=profile.php class=table>編輯個人資料</a><br><a href=profile.php?action=show&uid=$winddb[uid] class=table>查看個人資料</a><br><a href=job.php?action=favor class=table>收藏夾</a>')"><font class=table>控制面板</font></a>

獻花 x0
引用 | 編輯 detecti41258
2005-08-08 14:21
8樓
  
還是不行! 在此宣布第一代下拉式選單測試失敗!

我不管怎麼改,網頁都是錯誤。

獻花 x0
引用 | 編輯 達人村惟祿
2005-08-08 14:25
9樓
  
你使用367樓的檔案試試看 其他的都改回來

如果不行 我也沒有辦法了

獻花 x0
引用 | 編輯 detecti41258
2005-08-08 14:35
10樓
  
算了! 我連這個都沒辦法了,我也不用開站了。

所有方法都試過了

獻花 x0
引用 | 編輯 aa
2005-08-08 14:40
11樓
  
我的 common.js
複製程式
var h;
var l;
var t;
var isvisible;
function hidemenu(evt) 
{
       var mX;
       var mY;
       var vDiv;
    if (isvisible == true)
       {
              if (!evt) var evt = window.event;
              if (document.all) {
                  vDiv = document.all("menuDiv");
              } else {
                  vDiv = document.getElementById("menuDiv");
              }
              
              vDivWidth = (vDiv.offsetWidth > 0) ? vDiv.offsetWidth : 104;
              vDivHeight = (vDiv.offsetHeight > 0) ? vDiv.offsetHeight : 203;
              
              if (evt.pageX || evt.pageY) {
                  mX = evt.pageX;
                  mY = evt.pageY;
              } else if (evt.clientX || evt.clientY) {
                  mX = evt.clientX + document.body.scrollLeft;
                  mY = evt.clientY + document.body.scrollTop;
              }
           if ((mX < parseInt(vDiv.style.left)) || (mX > parseInt(vDiv.style.left)+vDivWidth) || (mY < parseInt(vDiv.style.top)-h) || (mY > parseInt(vDiv.style.top)+vDivHeight)){
               vDiv.style.visibility = "hidden";
               isvisible = false;
           }
           //alert(mX+','+mY+','+vDiv.style.left+','+vDiv.style.top+','+vDiv.offsetWidth+','+vDiv.offsetHeight+','+h);
    }
}

function showmenu(evt,vMnuCode) {
       var vDiv;
       if(evt == null) evt = window.event; // For IE
    var vSrc = evt.srcElement? evt.srcElement : evt.target;  // IE使用srcElement, 而Firefox使用target
    vMnuCode = "<DIV style='PADDING-RIGHT: 6px; FILTER: shadow(color=#485A7A,direction=120); PADDING-BOTTOM: 6px;width:98px'><table border=0 cellspacing=1 cellpadding=4 bgcolor=#376594 style='line-height:17px' width=ྞ' align='center'><tr bgcolor='#FFFFFF'><td width=14 background='images/menubg.gif' style='background-color: #4C85B2; background-repeat: no-repeat ;line-height:15px ; color: #FFFFFF' width=ྞ' align='center' valign='top'><img src='' height=5 width=1><br>數<br>位<br>男<br>女</td><td bgcolor='E9EEF3'>" + vMnuCode + "</td></tr></table></div>";
    h = vSrc.offsetHeight + 0;
    l = vSrc.offsetLeft + 0;
    t = vSrc.offsetTop + h;
    vParent = vSrc.offsetParent;
    while (vParent.tagName.toUpperCase() != "BODY")
    {
        l += vParent.offsetLeft;
        t += vParent.offsetTop;
        vParent = vParent.offsetParent;
    }
    vDiv=document.getElementById("menuDiv")
    vDiv.innerHTML = vMnuCode;
    vDiv.style.top = t;
    vDiv.style.left = l;
    vDiv.style.visibility = "visible";
    isvisible = true;
    
}

然後 header.htm 中要用,請自已運用修改,重點在 showmenu 的參數

複製程式
<body vlink=333333 link=333333 alink=333333 leftmargin=Ɔ' rightmargin=Ɔ' topmargin=Ɖ' bottommargin=Ɔ' onmousemove=hidemenu(event)>

複製程式
| <a href='faq.php?faqjob=4#6' onmouseover="showmenu(event,'<a href=faq.php?faqjob=4#6>贊助本站</a><br><a href=shopping.php>形象商品</a><br><a href=shopping.php?x=2#1>馬克杯</a><br>----------<br><a href=video.php>視訊聊天</a><br><a href=http://0949.gg.to target=_blank>國際節費</a>')" class=table>贊助</a>


獻花 x1
引用 | 編輯 detecti41258
2005-08-08 17:43
12樓
  
站長發佈的方法,非常的成功。

非常感謝能完成史上PHPWind1.3.6的下拉式選單!

獻花 x0
引用 | 編輯 detecti41258
2005-08-08 18:33
13樓
  
網頁又發錯誤,誰能幫我看看原因是在哪裡。

common.js
複製程式
var h;
var l;
var t;
var isvisible;
function hidemenu(evt) 
{
       var mX;
       var mY;
       var vDiv;
    if (isvisible == true)
       {
              if (!evt) var evt = window.event;
              if (document.all) {
                  vDiv = document.all("menuDiv");
              } else {
                  vDiv = document.getElementById("menuDiv");
              }
              
              vDivWidth = (vDiv.offsetWidth > 0) ? vDiv.offsetWidth : 104;
              vDivHeight = (vDiv.offsetHeight > 0) ? vDiv.offsetHeight : 203;
              
              if (evt.pageX || evt.pageY) {
                  mX = evt.pageX;
                  mY = evt.pageY;
              } else if (evt.clientX || evt.clientY) {
                  mX = evt.clientX + document.body.scrollLeft;
                  mY = evt.clientY + document.body.scrollTop;
              }
           if ((mX < parseInt(vDiv.style.left)) || (mX > parseInt(vDiv.style.left)+vDivWidth) || (mY < parseInt(vDiv.style.top)-h) || (mY > parseInt(vDiv.style.top)+vDivHeight)){
               vDiv.style.visibility = "hidden";
               isvisible = false;
           }
           //alert(mX+','+mY+','+vDiv.style.left+','+vDiv.style.top+','+vDiv.offsetWidth+','+vDiv.offsetHeight+','+h);
    }
}

function showmenu(evt,vMnuCode) {
       var vDiv;
       if(evt == null) evt = window.event; // For IE
    var vSrc = evt.srcElement? evt.srcElement : evt.target;  // IE使用srcElement, 而Firefox使用target
    vMnuCode = "<DIV style='PADDING-RIGHT: 6px; FILTER: shadow(color=#999999,direction=120); PADDING-BOTTOM: 6px;width:98px'><table border=0 cellspacing=1 cellpadding=4 bgcolor=#666666 style='line-height:17px' width=ྞ' align='center'><tr bgcolor='#FFFFFF'><td width=14 background='images/menubg.gif' style='background-color: #666666; background-repeat: no-repeat ;line-height:15px ; color: #FFFFFF' width=ྞ' align='center' valign='top'><img src='' height=5 width=1><br>X<br>X<br>X<br>X</td><td bgcolor='#FFFFFF'>" + vMnuCode + "</td></tr></table></div>";
    h = vSrc.offsetHeight + 0;
    l = vSrc.offsetLeft + 0;
    t = vSrc.offsetTop + h;
    vParent = vSrc.offsetParent;
    while (vParent.tagName.toUpperCase() != "BODY")
    {
        l += vParent.offsetLeft;
        t += vParent.offsetTop;
        vParent = vParent.offsetParent;
    }
    vDiv=document.getElementById("menuDiv")
    vDiv.innerHTML = vMnuCode;
    vDiv.style.top = t;
    vDiv.style.left = l;
    vDiv.style.visibility = "visible";
    isvisible = true;
    
}



header.htm
複製程式
<body vlink=333333 link=333333 alink=333333 leftmargin=Ɔ' rightmargin=Ɔ' topmargin=Ɔ' bottommargin=Ɔ' onmousemove=hidemenu(event)>
<script language="JavaScript" src="require/common.js"></script>
<div id=menuDiv style="visibility: hidden; width: 0px; position: absolute; height: 0px"></div>


獻花 x1
引用 | 編輯 detecti41258
2005-08-08 22:27
14樓
  
由於網路上分享的common.js的檔案有錯誤,所以我將已測試成功的1.3.6下拉式選單的製作方法分享出來。
此插件是本論壇站長提供的,在此非常感謝。



1.找
<body vlink=333333 link=333333 alink=333333 leftmargin=Ɔ' rightmargin=Ɔ' topmargin=Ɔ' bottommargin=Ɔ'>
改成
<!---->
<script language="JavaScript" src="require/topmenu.js"></script>

<body vlink=333333 link=333333 alink=333333 leftmargin=Ɔ' rightmargin=Ɔ' topmargin=Ɔ' bottommargin=Ɔ' onmousemove=hidemenu(event)>
<div id=menuDiv style="visibility: hidden; width: 0px; position: absolute; height: 0px"></div>



2.將common.js檔案換成topmenu.js檔案:
以下是topmenu.js檔案的內容!

複製程式
var h;
var l;
var t;
var isvisible;
function hidemenu(evt) 
{
       var mX;
       var mY;
       var vDiv;
    if (isvisible == true)
       {
              if (!evt) var evt = window.event;
              if (document.all) {
                  vDiv = document.all("menuDiv");
              } else {
                  vDiv = document.getElementById("menuDiv");
              }
              
              vDivWidth = (vDiv.offsetWidth > 0) ? vDiv.offsetWidth : 104;
              vDivHeight = (vDiv.offsetHeight > 0) ? vDiv.offsetHeight : 203;
              
              if (evt.pageX || evt.pageY) {
                  mX = evt.pageX;
                  mY = evt.pageY;
              } else if (evt.clientX || evt.clientY) {
                  mX = evt.clientX + document.body.scrollLeft;
                  mY = evt.clientY + document.body.scrollTop;
              }
           if ((mX < parseInt(vDiv.style.left)) || (mX > parseInt(vDiv.style.left)+vDivWidth) || (mY < parseInt(vDiv.style.top)-h) || (mY > parseInt(vDiv.style.top)+vDivHeight)){
               vDiv.style.visibility = "hidden";
               isvisible = false;
           }
           //alert(mX+','+mY+','+vDiv.style.left+','+vDiv.style.top+','+vDiv.offsetWidth+','+vDiv.offsetHeight+','+h);
    }
}

function showmenu(evt,vMnuCode) {
       var vDiv;
       if(evt == null) evt = window.event; // For IE
    var vSrc = evt.srcElement? evt.srcElement : evt.target;  // IE¨Ï¥ÎsrcElement, ¦ÓFirefox¨Ï¥Îtarget
    vMnuCode = "<DIV style='PADDING-RIGHT: 6px; FILTER: shadow(color=#485A7A,direction=120); PADDING-BOTTOM: 6px;width:98px'><table border=0 cellspacing=1 cellpadding=4 bgcolor=#376594 style='line-height:17px' width=ྞ' align='center'><tr bgcolor='#FFFFFF'><td width=14 background='images/menubg.gif' style='background-color: #4C85B2; background-repeat: no-repeat ;line-height:15px ; color: #FFFFFF' width=ྞ' align='center' valign='top'><img src='' height=5 width=1><br>¼Æ<br>¦ì<br>¨k<br>¤k</td><td bgcolor='E9EEF3'>" + vMnuCode + "</td></tr></table></div>";
    h = vSrc.offsetHeight + 0;
    l = vSrc.offsetLeft + 0;
    t = vSrc.offsetTop + h;
    vParent = vSrc.offsetParent;
    while (vParent.tagName.toUpperCase() != "BODY")
    {
        l += vParent.offsetLeft;
        t += vParent.offsetTop;
        vParent = vParent.offsetParent;
    }
    vDiv=document.getElementById("menuDiv")
    vDiv.innerHTML = vMnuCode;
    vDiv.style.top = t;
    vDiv.style.left = l;
    vDiv.style.visibility = "visible";
    isvisible = true;
    
}



3.加入選單,以下是範例
複製程式
| <a href='faq.php?faqjob=4#6' onmouseover="showmenu(event,'<a href=faq.php?faqjob=4#6>贊助本站</a><br><a href=shopping.php>形象商品</a><br><a href=shopping.php?x=2#1>馬克杯</a><br>----------<br><a href=video.php>視訊聊天</a><br><a href=http://0949.gg.to target=_blank>國際節費</a>')" class=table>贊助</a>


獻花 x0