ToolTip特效 JavaScript 盗取厦门人才网的特效
原文发布时间为:2009-05-17 —— 来源于本人的百度文章 [由搬家工具导入]
源代码:http://www.xmaspx.com/Services/FileAttachment.ashx?AttachmentID=43
<html>
<head>
<title>笑傲心扬百度空间</title>
<script type="text/javascript">
window.onerror=new Function("return true");
if (document.all)
{
document.write("<div id=tip style='position:absolute; width:210px; z-index:1;
background-color: #7D84B9; border: 1px solid gray; overflow: visible;visibility: hidden;font-
size:12px;padding:12px;color:#ffffff'></div>")
}
else
{
if (document.layers)
{
document.write("<layer id=tip visibility='hide' bgcolor='#7D84B9'></layer>")
}
else
{
document.write("<div id=tip style='position:absolute; width:230px; z-index:1;
background-color: #7D84B9; border: 1px solid gray; overflow: visible;visibility: hidden;font-
size:12px;padding:12px;color:#ffffff'></div>")
}
}
var posx=0;
var posy=0;
document.onmousemove = mouseMove;
function mouseMove(ev){
ev = ev || window.event;
var mousePos = mouseCoords(ev);
posx = mousePos.x;
posy = mousePos.y;
}
function mouseCoords(ev){
if(ev.pageX || ev.pageY){
return {x:ev.pageX, y:ev.pageY};
}
return {
x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
y:ev.clientY + document.body.scrollTop - document.body.clientTop
};
}
document.onmousedown = mouseDown;
function mouseDown(ev){
ev = ev || window.event;
var target = ev.target || ev.srcElement;
if(target.onmousedown || target.getAttribute('DragObj')){
return false;
}
}
function showalt(w){
if (w=="")return;
var dv = document.getElementById("tip");
dv.innerHTML=w + "<br>";
if (document.all)
{
dv.style.visibility="visible";
dv.style.left=posx+10; // event.x+10+document.body.scrollLeft;
dv.style.pixelTop=posy+10; // event.y+10+document.body.scrollTop;
}
else
{
if (document.layers)
{
dv.visibility="show";
dv.left=posx+10;
dv.top=posy+10;
}
else
{
dv.style.visibility="visible";
dv.style.left= posx+10 ;
dv.style.top= posy+10 ;
}
}
}
function hidealt(){
var dv = document.getElementById("tip");
dv.style.innerHTML=""
if (document.all)
{
dv.style.visibility="hidden";
}
else
{
if (document.layers)
{
dv.visibility="hide";
}
else
{
dv.style.visibility="hidden";
}
}
}
</script>
</head>
<body>
<a href = "http://hi.baidu.com/handboy" onmousemove='showalt("点击进入我的百度空间
<br/>http://hi.baidu.com/handboy")' onmouseout='hidealt()'>笑傲心扬的百度空间</a></p>
</body>
</html>