| 首页 | 技术文章 | 软件下载 | 博客 | 论坛 | 精品教程 | 黑客动画 | 视频资源 | 在线服务 | 黑客游戏 | 

您现在的位置: 中国X黑客小组 >> 技术文章 >> 编程技术 >> 网络编程 >> 文章正文 用户登录 新用户注册
  对一个IP只弹出一次窗口         ★★★ 【字体:
对一个IP只弹出一次窗口
作者:未知    文章来源:CnXHacker.Net    点击数:    更新时间:2005-2-1    

一个IP只弹出一次的退窗代码
<%
if session("ad")<>"ad" then
%>
<SCRIPT event=onunload for=window>       
window.open('http://www.cnxhacker.com')    
</SCRIPT>
<%
session("ad")="ad"
end if
%>

一个IP只弹出一次代码
<script>
 
  var cookieString = new String(documents.cookie)
  var cookieHeader = 'happy_pop=' //更换happy_pop为任意名称
  var beginPosition = cookieString.indexOf(cookieHeader)
  if (beginPosition <0){
window.open('http://你要弹出的ul','','top=0,left=0,width=787,height=
480,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,location=yes,status=yes');
var Then = new Date()    
   Then.setTime(Then.getTime() + 12*60*60*1000 ) //同一ip设置过期时间,即多长间隔跳出一次
   documents.cookie = 'happy_pop=yes;expires='+ Then.toGMTString()  //更换happy_pop和第4行一样的名称
    }

</script>
sethome()
}
//-->
</script>

一个IP只提示一次设为首页的代码
<script>
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = documents.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (documents.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = documents.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}

function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
documents.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}

function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
// This cookie is history
var cval = 0;
documents.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

//设置cookies时间,自己根据情况设置。
var expDays = 1;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function amt(){
var count = GetCookie('count'); //同一ip只显示一次
//var count;//同一ip只显示N次
//alert(count);
//count = null;
if(count == null) {
SetCookie('count','1')
return 1
}
else{
var newcount = parseInt(count) + 1;
if(newcount<2) count=1;
SetCookie('count',newcount,exp);
//DeleteCookie('count')
return newcount
}
}

function getCookieVal(offset) {
var endstr = documents.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = documents.cookie.length;
return unescape(documents.cookie.substring(offset, endstr));
}
function sethome(){
document.links[0].style.behavior='url(#default#homepage)';
document.links[0].setHomePage('http://www.cnxhacker.com');
}
if(amt()==1)
{
sethome()
}
//-->
</script>

文章录入:IceRiver    责任编辑:IceRiver 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
    对一台虚拟主机服务器的渗透
    微软携安全厂商建统一战线 M
    警惕:又一个通过 MSN传播的
    杀毒软件网络防火墙一个都不
    asp+语法介绍(二)-书写我们
    shell编程例子 -- 一个简单的
    shell编程例子 -- 一个.cshr
    shell编程例子 -- 一个.logi
    探密QQ登陆加密算法兼谈简单
    一个最优的算法
      网友评论:(只显示最新5条。评论内容只代表网友观点,与本站立场无关!)
    Powered by ICE RIVER - STUDIO
    » CnXHacker.CoM   © CopyRight 2002-2006, CnXHacker.CoM™, Inc. All Rights Reserved.