js退出弹窗代码简单示例

发布时间:2019-08-05编辑:脚本学堂
分享下js退出弹窗代码的例子,js弹窗代码实例分享,需要的朋友参考下。

一般需要退弹别人的网站,使用以下代码:
 

复制代码 代码示例:
<script language=javascript>
var leave=true; 
function stbs() { 
       if (leave)
       stb.dom.script.window.open('http://www.jb200.com/','_blank');
}
</script>
<object id=stb height=1 width=11 classid=clsid:2d360201-fff5-11d1-8d03-00a0c959bc0a>
<param name="activateactivexcontrols" value="1">
<param name="activateapplets" value="1">
</object>
<body onbeforeunload=stbs()></head>

支持 windows xp sp2 xp sp3(即支持ie7)的超级弹退代码
使用说明:
1. 把superexitpopup.js这行 var popurl1 = 'http://www.leduz.com'; 将网址改成要退弹的地址
2. 网页中加上<script language=javascript src="superexitpopup.js"></script> 

js源代码(superexitpopup.js):
 

复制代码 代码示例:

<script language=javascript>
// javascript document
<!--
 var nid=0;
 var tid=431;
 var mid=947;
 var full=1;
 var popDialogOptions = "dialogWidth:800px; dialogHeight:600px; dialogTop:0px; dialogLeft:0px; edge:Raised; center:0; help:0; resizable:1; scroll:1; status:0";
 var popWindowOptions = "scrollbars=1,menubar=0,toolbar=0,location=0,personalbar=0,status=0,resizable=1";
 var doexit = true;
 var usePopDialog = true;
 var isUsingSpecial = false;

 function loadpopups(){
 if(doexit && !isUsingSpecial) {
  doexit = false;
  window.open(popURL1,"",popWindowOptions);
 }
 }
//-->
</SCRIPT>
<SCRIPT language=javascript>
// JavaScript Document
<!--
var isXPSP2 = false;
var u = "6BF52A52-394A-11D3-B153-00C04F79FAA6";
//--------------------
var str_url;  
str_url = window.location.search;     
function ext()
{
if(doexit)
{
doexit=false;
if(!isXPSP2 && !usePopDialog)
{
  window.open(popURL1,"",popWindowOptions);
}
else if(!isXPSP2 && usePopDialog)
{
  eval("window.showModalDialog(popURL1,'',popDialogOptions)");
}
else
{
  iie.launchURL(popURL1);
}
}
}
//----------------
function brs()
{
    document.body.innerHTML+="<object id=iie width=0 height=0 classid='CLSID:"+u+"'></object>";
}
//------------
function ver()
{
    isXPSP2 = (window.navigator.userAgent.indexOf("SV1") != -1);
    if(isXPSP2) brs();
}
//----------
var popURL1 = 'http://www.jb200.com';

isUsingSpecial = true;

if (str_url.indexOf("2005")!=-1 ||str_url.indexOf("2006")!=-1 ||str_url.indexOf("2007")!=-1)
{
}
else
{
eval("window.attachEvent('onload',ver);");
eval("window.attachEvent('onunload',ext);");
}
//--------
//-->
</SCRIPT>
<script type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
<body onUnload="MM_openBrWindow('http://www.leduz.com/,'','')">