javascript 关闭按钮事件

qq_21917731 2015-06-30 07:28:05

<DIV id="lovexin13" class="fixed ie6"><a style="position:absolute;top:0px;right:0px;text-decoration: none;background:#000;text-align:center;color:white;" href=JavaScript:; onclick=lovexin13.style.display="none";>×</a>
<iframe id="server" style="width:300px;height:250px;z-index:100;background:#fff;position:absolute;filter:alpha(opacity=0);-moz-opacity:0;opacity:0;" src="bb.php '" width="300" height="250" frameborder="no" border="0" scrolling="no" allowtransparency="yes"></iframe></div>


<script>
var IframeOnClick = {
resolution: 200,
iframes: [],
interval: null,
Iframe: function() {
this.element = arguments[0];
this.cb = arguments[1];

this.hasTracked = false;
},
track: function(element, cb) {
this.iframes.push(new this.Iframe(element, cb));
if (!this.interval) {
var _this = this;
this.interval = setInterval(function() { _this.checkClick(); }, this.resolution);
}
},

checkClick: function() {
if (document.activeElement) {
var activeElement = document.activeElement;
for (var i in this.iframes) {
if (activeElement === this.iframes[i].element) {
if (this.iframes[i].hasTracked == false) {
this.iframes[i].cb.apply(window, []);
this.iframes[i].hasTracked = true;
}
} else {
this.iframes[i].hasTracked = false;
}
}
}
}
};
var cookie_name = 'qw_rc';
var cookie_val = 'RRDEGTRY41521';
var cookie_real = dd_getcookie(cookie_name);
if(cookie_real!=cookie_val){
IframeOnClick.track(document.getElementById("server"), function() {
setTimeout(dd_hideme,500);
var img=new Image();
img.src='http://<?=$http?>/v/count.php?<?=$ads?>&<?=$uid?>_'+new Date().getTime()
});
}else{
document.getElementById("server").style.display = 'none';
}



function dd_hideme(){
document.getElementById("server").style.display="none";
dd_setcookie(cookie_name,cookie_val);
}

function dd_setcookie(name,value){
var Days = 6;
var exp = new Date();
exp.setTime(exp.getTime() + Days*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}


function dd_getcookie(name){
var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
if(arr != null){
return (arr[2]);
}else{
return "";
}
}

//删除cookies
function dd_delCookie(name)
{
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=dd_getCookie(name);
if(cval!=null)
document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}
</script>


以上实现的是点击框架显示的内容后,页面就空白,这个iframe层关闭掉,下面JS同时实现了访问'http://<?=$http?>/v/count.php 文件
现在想要实现,<a style="position:absolute;top:0px;right:0px;text-decoration: none;background:#000;text-align:center;color:white;" href=JavaScript:; onclick=lovexin13.style.display="none";>×</a> 点击关闭按钮时,关闭掉,同时点击到iframe aa.php里面的内容,同时访问count.php 文件
请大神指定,贴个详细代码。
...全文
205 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_21917731 2015-07-04
  • 打赏
  • 举报
回复
有没得大神!
qq_21917731 2015-07-01
  • 打赏
  • 举报
回复
来人给看看。!

52,787

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧