首页 | 源码下载 | 网站模板 | 网页特效 | 广告代码 | 网页素材 | 字体下载 | 书库 | 站长工具
会员投稿 投稿指南 RSS订阅
当前位置:主页>设计在线>网页设计>资讯:超强退弹 xp sp3 ie6.0 [不侵占父窗口]

超强退弹 xp sp3 ie6.0 [不侵占父窗口]

www.jz123.cn  2010-01-02   来源:   中国建站       我要投递新闻

  代码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.tianqila.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.tianqila.com/'; 请修改为你自己的网址,

  2.时间控制,setCookie("tuitan","yes",12); 其中12代表12小时退弹一次;如果setCookie("tuitan","yes",24);则代表24小时退弹一次,

  


上一篇:19个Web安全字体 下一篇:网页设计中翻页代码居中的问题

评论总数:0 [ 查看全部 ] 网友评论


关于我们隐私版权广告服务友情链接联系我们网站地图