QQ网站的链接文字提示特效_文本链接特效

模板酷站
  •       3/5
  •       1
  •       2
  •       3
  •       4
  •       5
查看演示效果

      织梦DedeCMS视频教程买空间 租服务器 选网硕互联! 无忧站长工具,百度权重一键全查!

      腾讯QQ网站的一款链接文字提示特效,可以提示你是否打开网址、复制网址、关闭层的功能,用JS实现网址复制功能。代码虽小,但很实用。

      <!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 type="text/javascript"> function S(i){return document.getElementById(i)} function copyUrl(){//复制网址 var clipBoardContent=S("downloadDirect").href; try{ window.clipboardData.setData("Text",clipBoardContent); alert("复制成功!"); }catch(e){ alert("复制失败!"); } } document.onclick = function(evt){//非链接单击时,隐藏对应层 var _target = evt ? evt.target : event.srcElement ; var _id = _target.id; if( _id == "" ){ _id = _target.tagName; } if( _id !="A"){ S("downloadPanel").style.display = 'none'; } } window.onload=function(){//网页加载时绑定对象 var xx=S("xx"); var xxx = xx.getElementsByTagName("a"); for(var i=0,j=xxx.length; i<j; i++){ xxx[i].onclick=function(evt){ var _event = evt ? evt : window.event; var _target = evt ? evt.target : window.event.srcElement; var _p = S("downloadPanel"); _p.style.top = _event.clientY + document.body.scrollTop ; _p.style.left = ( _event.clientX + document.body.scrollLeft < 160 ? _event.clientX + document.body.scrollLeft + 10 : _event.clientX + document.body.scrollLeft - 120 ); S("downloadPanel").style.display = ''; S("downloadDirect").href= this.href; return false; } } } </script> <style type="text/css"> html,body{ font-size:12px;} a {color:#4d5d2c;text-decoration:underline;cursor:pointer;} .pointer {cursor:pointer;} .infobar {background:#fff9e3;border:1px solid #fadc80;color:#743e04;margin-bottom:10px;padding:8px 20px 4px 20px;} </style> </head> <body> <div id="downloadPanel" style="position:absolute;top:0px;left:0px;width:160px;z-index:999;padding:6px 2px 6px 10px;border:1px solid #fb7;display:none;" class="infobar"> <div style="padding:3px 0 0 0;"><a id="downloadDirect" href="javascript:void(0);" target="_blank">打开网址</a> <a id="downloadAgent" href="javascript:void(0);" onclick="copyUrl()">复制</a> <a href="javascript:void(0)" onclick="S('downloadPanel').style.display = 'none';">关闭</a></div> </div> 点击链接试试看:<br /><br /> <div id="xx"> <a href="/">Mb5u.com</a><br /><br /> <a href="/jscss/">精品网页特效</a><br /><br /> </div> </body> </html>