html无限循环弹出窗代码,html网页弹窗代码(一个IP24小时只弹一次)

这段代码实现了一个HTML网页弹窗功能,确保每个IP地址在24小时内只会弹出一次。你可以通过修改代码中的时间常量来调整弹窗间隔。弹窗内容和网址都可以根据需求进行定制。代码包括HTML部分和JavaScript部分,只需将HTML代码插入到网页源码中,JS代码放入外部文件并引用。已验证代码有效。
摘要由CSDN通过智能技术生成

html网页弹窗代码(一个IP24小时只弹一次),如果想改时间请修改代码中的1000*60*60*24,把24改成几就是几小时弹一次了,第一框的是HMTL代码,直接放入HTML源码中就可以了,第二框的是JS代码,放在JS文件中,在网页中调用JS文件就可以了,已测试可用。记得修改你要弹出的网址替换代码中的www.3gmfw.cn

function setCookie(name, value, expire) {

window.document.cookie = name + "=" + escape(value) + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()));

}

function getCookie(Name) {

var search = Name + "=";

if (window.document.cookie.length > 0) { // if there are any cookies

offset = window.document.cookie.indexOf(search);

if (offset != -1) { // if cookie exists

offset += search.length;

// set index of beginning of value

end = window.document.cookie.indexOf(";", offset)

// set index of end of cookie value

if (end == -1)

end = window.document.cookie.length;

return unescape(window.document.cookie.substring(offset, end));

}

}

return null;

}

function register(name) {

var today = new Date();

var expires = new Date();

expires.setTime(today.getTime() + 1000*60*60*24);

setCookie("ItDoor", name, expires);

}

var exitURL="http://www.3gmfw.cn/";

function openWin() {

var c = getCookie("ItDoor");

if (c != null) {

return;

}

register("xiaolin");

var featureStr="''";

featureStr="'top=0,left=0,width=800,height=600,toolbar=yes, menubar=no, scrollbars=no, resizable=no, location=no, status=no,center:no'";

self.focus();

var ExitWindow = window.open(exitURL,'', featureStr);

ExitWindow.focus();

}

openWin();

window.focus()

document.writeln("

document.writeln("function setCookie(name, value, expire) { ");

document.writeln(" window.document.cookie = name + \"=\" + escape(value) + ((expire == null) ? \"\" : (\"; expires=\" + expire.toGMTString())); ");

document.writeln("} ");

document.writeln("");

document.writeln("function getCookie(Name) { ");

document.writeln(" var search = Name + \"=\"; ");

document.writeln(" if (window.document.cookie.length > 0) { \/\/ if there are any cookies ");

document.writeln(" offset = window.document.cookie.indexOf(search); ");

document.writeln(" if (offset != -1) { \/\/ if cookie exists ");

document.writeln(" offset += search.length;");

document.writeln("\/\/ set index of beginning of value ");

document.writeln(" end = window.document.cookie.indexOf(\";\", offset) ");

document.writeln("\/\/ set index of end of cookie value");

document.writeln(" if (end == -1)");

document.writeln(" end = window.document.cookie.length;");

document.writeln(" return unescape(window.document.cookie.substring(offset, end));");

document.writeln(" }");

document.writeln(" }");

document.writeln(" return null;");

document.writeln("}");

document.writeln("function register(name) {");

document.writeln(" var today = new Date();");

document.writeln(" var expires = new Date();");

document.writeln(" expires.setTime(today.getTime() + 1000*60*60*24);");

document.writeln(" setCookie(\"ItDoor\", name, expires);");

document.writeln("}");

document.writeln(" var exitURL=\"http:\/\/www.3gmfw.cn\/\";");

document.writeln("function openWin() {");

document.writeln("");

document.writeln(" var c = getCookie(\"ItDoor\");");

document.writeln(" if (c != null) {");

document.writeln(" return;");

document.writeln(" }");

document.writeln(" register(\"xiaolin\");");

document.writeln(" ");

document.writeln(" var featureStr=\"\'\'\";");

document.writeln(" ");

document.writeln(" featureStr=\"\'top=0,left=0,width=800,height=600,toolbar=yes, menubar=no, scrollbars=no, resizable=no, location=no, status=no,center:no\'\";");

document.writeln("");

document.writeln(" ");

document.writeln(" self.focus();");

document.writeln(" ");

document.writeln(" var ExitWindow = window.open(exitURL,\'\', featureStr);");

document.writeln(" ExitWindow.focus();");

document.writeln(" ");

document.writeln("}");

document.writeln("openWin();");

document.writeln("window.focus()");

document.writeln("<\/Script>")

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值