ToolTip effect JavaScript steal the special effects of Xiamen talent Network

Source: Internet
Author: User
Tags visibility

The original Published time: 2009-05-17--from my Baidu article [imported by moving tools]

Source code: HTTP://WWW.XMASPX.COM/SERVICES/FILEATTACHMENT.ASHX?ATTACHMENTID=43

<title> smile proud of the heart of the Baidu space </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>
<body>
<a href = "Http://hi.baidu.com/handboy" onmousemove= ' Showalt ("Click to enter my Baidu space

<br/>http://hi.baidu.com/handboy ") ' onmouseout= ' Hidealt () ' > Smile proud of the heart of the Baidu space </a></p>
</body>

ToolTip effect JavaScript steal the special effects of Xiamen talent Network

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.