<!
DOCTYPE html PUBLIC
"
-//W3C//DTD XHTML 1.0 Transitional//EN
"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
"
>
<
html xmlns
=
"
http://www.w3.org/1999/xhtml
"
>
<
head
>
<
title
>
让超链接显示提示信息
</
title
>
<
script
>
if
(
!
document.layers
&&!
document.all) event
=
"
test
"
function
showtip2(current,e,text)
{ if (document.all&&document.readyState=="complete"){ document.all.tooltip2.innerHTML="<marquee style='border:1px solid black'>"+text+"</marquee>" document.all.tooltip2.style.pixelLeft=event.clientX+document.body.scrollLeft+10 document.all.tooltip2.style.pixelTop=event.clientY+document.body.scrollTop+10 document.all.tooltip2.style.visibility="visible" } else if (document.layers){ document.tooltip2.document.nstip.document.write("<b>"+text+"</b>") document.tooltip2.document.nstip.document.close() document.tooltip2.document.nstip.left=0 currentscroll=setInterval("scrolltip()",100) document.tooltip2.left=e.pageX+10 document.tooltip2.top=e.pageY+10 document.tooltip2.visibility="show" } }
function
hidetip2()
{ if (document.all) document.all.tooltip2.style.visibility="hidden" else if (document.layers){ clearInterval(currentscroll) document.tooltip2.visibility="hidden" } }
function
scrolltip()
{ if (document.tooltip2.document.nstip.left>=-document.tooltip2.document.nstip.document.width) document.tooltip2.document.nstip.left-=5 else document.tooltip2.document.nstip.left=150 }
</
script
>
</
head
>
<
body
>
<
p
>
显示静态文本信息
</
p
>
<
a href
=
"
http://www.yesky.com
"
title
=
"
中国最大的中文IT垂直网站
"
>
天极网
</
a
>
<
p
>
显示动态文本信息
</
p
>
<
div id
=
"
tooltip2
"
style
=
"
position:absolute;visibility:hidden;clip:rect(0 150 50 0);width:150px;background-color:lightyellow
"
>
<
layer name
=
"
nstip
"
width
=
"
1000px
"
bgColor
=
"
lightyellow
"
>
</
layer
>
</
div
>
<
a href
=
"
http://www.yesky.com
"
onMouseover
=
"
showtip2(this,event,'中国最大的中文IT垂直网站!内容非常丰富多采')
"
onMouseout
=
"
hidetip2()
"
>
天极网
</
a
>
</
body
>
</
html
>
转载于:https://www.cnblogs.com/pageantry/archive/2007/01/08/615025.html
相关资源:让超链接显示提示信息的js代码
转载请注明原文地址: https://win8.8miu.com/read-7508.html