点击网址浮出层进行复制或打开等选项操作特效(图)

来源:互联网 发布:软件二次开发价格 编辑:程序博客网 时间:2024/05/18 06:13
<IFRAME name=google_ads_frame marginWidth=0 marginHeight=0 src="http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-4490194096475053&amp;dt=1228266017640&amp;lmt=1226285635&amp;prev_slotnames=1891601125&amp;output=html&amp;slotname=3685991503&amp;correlator=1228266017609&amp;url=http%3A%2F%2Fwww.corange.cn%2Farchives%2F2008%2F09%2F1743.html&amp;ea=0&amp;ref=http%3A%2F%2Fwww.corange.cn%2Fhtml%2Fcorange__94.html&amp;frm=0&amp;ga_vid=2091876339.1227189135&amp;ga_sid=1228265172&amp;ga_hid=2135791240&amp;ga_fc=true&amp;flash=9.0.124.0&amp;u_h=768&amp;u_w=1024&amp;u_ah=738&amp;u_aw=1024&amp;u_cd=32&amp;u_tz=480&amp;u_java=true&amp;dtd=16" frameBorder=0 width=300 scrolling=no height=250 allowTransparency></IFRAME>
<html>
<head>
<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(){//网页载入时,绑定指定对象下的所有a
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>
<div id="xx">
<a href="http://www.alixixi.com">http://www.alixixi.com</a><br />
<a href="http://www.qqtheme.com">http://www.qqtheme.com</a><br />
<a href="http://www.psp-theme.com">http://www.psp-theme.com</a><br />
<a href="http://www.sina.com">http://www.sina.com</a><br />
<a href="http://www.qq.com">http://www.qq.com</a><br /><br />
</div>
</body>
</html>
原创粉丝点击