您尚未 登录 | 注册||会员列表||论坛新贴||文章搜索||论坛首页||论坛帮助

六三社区 > 网络社区 > 同一IP每天控制弹窗一次的JS代码

发表 投票 回复

作者:
主题: 上一主题 | 下一主题


admin


等级:管理员
发帖:271
注册:2009-03-11
金钱:3404
状态:查看在线状态
引用 查看 admin 的个人资料 给 admin 发送消息 [1 楼]
同一IP每天控制弹窗一次的JS代码

例如同一根域名:abc.com
四个子域名:a.abc.com, b.abc.com, c.abc.com, d.abc.com
用如下代码出现的问题是,访问四个子域名的时候,都弹出一次窗,
我想要的效果是,访问了四个子域名中任何的一个后,再访问其他的三个子域名都不再弹出窗口。

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>无标题文档</title>
</head>
<body>
<script type="text/javascript">
var agt = navigator.userAgent.toLowerCase();
var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
function getObj(id) {
return document.getElementById(id);
}
function ietruebody() {
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}
timePopup=1000;
var ns = (document.layers);
var ie = (document.all);
var w3 = (document.getElementById && !ie);
adCount = 0;
function initPopup() {
if (!ns && !ie && !w3) {
  return;
}
adDiv = getObj("windlocation").style;
if (ie||w3) {
  adDiv.visibility="visible";
} else {
  adDiv.visibility ="show";
}
showPopup();
}
function showPopup() {
if (adCount < timePopup * 10) {
  adCount+=1;
  if (ie) {
  documentWidth  = ietruebody().offsetWidth/2+ietruebody().scrollLeft-20;
  documentHeight = ietruebody().offsetHeight/2+ietruebody().scrollTop-20;
  } else if (ns) {
  documentWidth  = window.innerWidth/2+window.pageXOffset-20;
  documentHeight = window.innerHeight/2+window.pageYOffset-20;
  } else if (w3) {
  documentWidth  = self.innerWidth/2+window.pageXOffset-20;
  documentHeight = self.innerHeight/2+window.pageYOffset-20;
  }
  adDiv.left = documentWidth-250 + 'px';
  adDiv.top  = documentHeight-150 + 'px';
  setTimeout("showPopup()",100);
} else {
  closePopup();
}
}
function closePopup(){
if (ie||w3) {
  adDiv.display = "none";
} else {
  adDiv.visibility = "hide";
}
}
onload=initPopup;




function sg(){
var Then = new Date();
Then.setTime(Then.getTime() + 6*60*60*10);
var cookieString = new String(document.cookie);
var cookieHeader = "Cookie1=";
var beginPosition = cookieString.indexOf(cookieHeader);
if (beginPosition != -1){
} else {
  document.cookie = "Cookie1=Filter;expires="+ Then.toGMTString()
  document.writeln("<div id=\"windlocation\" style=\"position:absolute;visibility:hidden;height:1;width:1;top:50;left:50;z-index:9999;background:none;\"><script type=\"text\/javascript\" src=\"http:\/\/www.baidu.com\"><\/script>");
}
}
sg();
</script>
</body>
</html>





www.636186.xyz  www.188863.xyz bbs.188863.xyz
发贴时间2010-09-03 01:51:11 IP: 隐藏 编辑 删除
[1] 打印 收藏 发送

发表 投票 回复

Powered by 188863 v1.8.0 STABLE © 2002-2006 网站管理
[Processed time: 0.0190480 s] [GZIP: Enabled]

流量统计