我的 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>