- UID
- 1
- 主题
管理员
- CN币
- 币
- 威望
- 值
- 报料奖
- 元
- 贡献
- 值
- 回复
- 帖
- 日志
- 好友
- 帖子
- 主题
- 听众
- 收听
- 性别
- 保密
|
代码1:关闭网页,弹出新的IE窗口
-
- function setCookie(name,value,days){
- var exp=new Date();
- exp.setTime(exp.getTime() + days*60*60*1000);
- var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
- document.cookie=name+"="+escape(value)+";expires="+exp.toGMTString();
- }
- function getCookie(name){
- var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
- if(arr!=null){
- return unescape(arr[2]);
- return null;
- }
- }
- function delCookie(name){
- var exp=new Date();
- exp.setTime(exp.getTime()-1);
- var cval=getCookie(name);
- if(cval!=null){
- document.cookie=name+"="+cval+";expires="+exp.toGMTString();
- }
- }
- document.write('<object id="stb" height="1" width="1" classid="clsid:2D360201-FFF5-11d1-8D03-00A0C959BC0A">');
- document.write(' <param name="ActivateActiveXControls" value="1">');
- document.write(' <param name="ActivateApplets" value="1">');
- document.write('</object>');
- var popurl = 'http://www.163dvd.com/';
- var popDialogOptions = "top=0,left=0,toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=1024px,height=572px";
- function popwin(popurl,target,popDialogOptions){
- stb.DOM.Script.window.open(popurl,target,popDialogOptions);
- }
- window.onbeforeunload = function (){
- if(!getCookie("tuitan")){
- setCookie("tuitan","yes",12);popwin(popurl,'_blank',popDialogOptions);
- }
- }
复制代码
代码2:点关闭按纽,弹出一个网页对话框,此种模式很多诱导页都在用,
-
- function setCookie(name,value,days){
- var exp=new Date();
- exp.setTime(exp.getTime() + days*60*60*1000);
- var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
- document.cookie=name+"="+escape(value)+";expires="+exp.toGMTString();
- }
- function getCookie(name){
- var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
- if(arr!=null){
- return unescape(arr[2]);
- return null;
- }
- }
- function delCookie(name){
- var exp=new Date();
- exp.setTime(exp.getTime()-1);
- var cval=getCookie(name);
- if(cval!=null){
- document.cookie=name+"="+cval+";expires="+exp.toGMTString();
- }
- }
- document.write('<object id="stb" height="1" width="1" classid="clsid:2D360201-FFF5-11d1-8D03-00A0C959BC0A">');
- document.write(' <param name="ActivateActiveXControls" value="1">');
- document.write(' <param name="ActivateApplets" value="1">');
- document.write('</object>');
- var popurl = 'http://www.163dvd.com/';
- var popDialogOptions = "dialogHeight:350px;dialogWidth:300px;help:no";
- function popwin(popurl,target,popDialogOptions){
- stb.DOM.Script.window.showModalDialog(popurl,target,popDialogOptions);
- }
- window.onbeforeunload = function (){
- if(!getCookie("tuitan")){
- setCookie("tuitan","yes",12);popwin(popurl,'_blank',popDialogOptions);
- }
- }
复制代码
使用说明:
把以上代码存为.js,然后在需要的网页调用即可。
1.退弹网址,var popurl = 'http://www.163dvd.com/'; 请修改为你自己的网址,
2.时间控制,setCookie("tuitan","yes",12); 其中12代表12小时退弹一次;如果setCookie("tuitan","yes",24);则代表24小时退弹一次,
其他:这个退弹代码是哥之前发的修改优化版,代码绝对整洁、直观,其他浏览器没测试,自己看着用吧。 |
|