//这里不用多说了,JS代码
<script language="JavaScript">
//----------------------写HTML代码----------------------
var changdi="<table style='margin:0 0 0 0;border:solid 1px #009933;background:#ffffff''><tr><td align='center' vlign='middle'><img src='../website/image/tips.jpg' width=50 height=50></td><td align='center' vlign='middle'><font color='green' size='6'>这里写你需要显示的东西,也重新写这个变量里面所有的HTML</font></td></tr></table>";
//------------------------------------------------------
var isIE = document.all?true:false;
function overlib(tipcontent)
{
customdiv = document.getElementById("overDiv");
customdiv2 = document.getElementById("overDiv2");
customdiv.innerHTML = tipcontent;
var tleft=document.body.scrollLeft+window.event.clientX;
var ttop=document.body.scrollTop+window.event.clientY;
if(document.body.clientWidth < 300)
{
customdiv.style.left = 2;
customdiv2.style.left = 2;
}
else if (tleft > document.body.clientWidth-200)
{
customdiv.style.left = tleft-175;
customdiv2.style.left = tleft-175;
}
else
{
customdiv.style.left = tleft + 10;
customdiv2.style.left = tleft + 10;
}
if(document.body.clientHeight < 100)
{
customdiv.style.top = 25;
customdiv2.style.top = 25;
}
else if(ttop > document.body.clientHeight -55)
{
customdiv.style.top = ttop - 55;
customdiv2.style.top = ttop - 55;
}
else
{
customdiv.style.top = ttop + 10;
customdiv2.style.top = ttop + 10;
}
customdiv2.style.width=customdiv.clientWidth;
customdiv2.style.height=customdiv.clientHeight;
customdiv.style.visibility = 'visible';
customdiv2.style.visibility = 'visible';
}
function nd()
{
customdiv = document.getElementById("overDiv");
customdiv2 = document.getElementById("overDiv2");
customdiv.style.width=0;
customdiv.style.height=0;
customdiv.style.visibility = 'hidden';
customdiv2.style.visibility = 'hidden';
}
function b(v)
{
window.status=v
};
</script>
//这里可以放在网页的任何地方,一个IFRAME,一个DIV,组合起来可以遮挡SELECT
<div id="overDiv" style="position:absolute; visibility:hidden;z-index:100;padding:0 0 0 0;background:#FDFEF9;text-align:left;font-size:12px;">
</div>
<iframe id="overDiv2" src="" scrolling="no" frameborder="no"style="position:absolute; visibility:hidden;z-index:99;filter: Alpha(style=0,opacity=0) "> </iframe>
//鼠标悬停调用
onMouseOver="return overlib(changdi)" onMouseOut="return nd();"
转载于:https://www.cnblogs.com/s021368/articles/1327408.html