超链接的跑马灯式提示信息
把你的“鼠标”移到下面链接上试一试,有什么不同呢?原来弹出了一条跑马灯式的提示信息,这是怎么实现的呢,请接着看:
源码粘贴框:
1.将下面代码放在<body>标签下:
<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>
2.然后在要出现提示信息的链接中,添加onMouseover语句:
<a href="index.htm" onMouseover="showtip2(this,event,'用marquee实现的各式跑马灯')" onMouseout="hidetip2()">跑马灯大全(一)</a> <a href="index.htm" onMouseover="showtip2(this,event,'最多最全的电脑交互教程')" onMouseout="hidetip2()">电脑交互教程</a> <a href="pmjq00.htm" onMouseover="showtip2(this,event,'点滴技巧装扮你的家')" onMouseout="hidetip2()">网页制作技巧技巧</a>
实现步骤: (1)先在<body>标签下面插入一段JavaScript代码;
(2)然后在需要实现跑马灯式提示信息效果的超链接中加入Onmouseover和Onmouseout语句。 [Web开发]彻底去掉ecshop中乱跑的“Powered by ECShop”字样… [办公软件]这样来修改PowerPoint超级链接的文字颜色 [办公软件]保留PowerPoint超链接,但是取消超链接的下划线 [办公软件]在PowerPoint中超级链接的设置技巧 [办公软件]VBA中初始化ADO连接的几种方法 [Web开发]使用正则表达式在NET中动态实现URL超级链接和邮件… [网页制作]如何去掉主页超链接的下划线? [网页制作]超级链接时如何设定目标窗口 [网页制作]给超级超链添加“确认”对话框 [网页制作]大众都在使用的通用的网页文字超级链接颜色示例
|