弹窗代码大全window.open
来源:互联网 发布:网络作家富豪 编辑:程序博客网 时间:2024/06/05 14:08
-----------随机弹一个窗---------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title> </title>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function numbers() {
var ok = 3;
var j=3;
var num=0;
for (var i = 1; i <= j; i++) {
num = Math.round(Math.random() * (j-1))+1;
}
adurl=new Array();
adurl[1]="http://www.qq.com"
adurl[2]="http://www.163.com"
adurl[3]="http://www.sohu.com"
window.open(adurl[num],target='_blank');
}
numbers();
// End -->
</script>
这样就可以了
</body>
</html>
---------------------
< script>
function openwin(){
window.open(”page.html”,”",”width=200,height=200″)
}
function get_cookie(Name) {
var search = Name + “=” var returnvalue = “”;
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(”;”, offset);
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function loadpopup(){
if (get_cookie(”popped”)==”){
openwin()
document.cookie=”popped=yes”
}
}
< /script>
--------------------
<script language="javascript">
function tanChuang()
{
window.open(" http://baidu.com"); //如果要弹出一系列窗口,可以定义一个全局数组变量,轮着弹
}
var myLink = window.document.getElementsByTagName("body");//取页面里的内容体
myLink[0].onload = tanChuang;//网页内容加载之后后弹出窗口
myLink[0].onclick = setInterval(tanchuang, 5000);//网页任何地方被点击后,每5秒钟,弹一次窗口
</script>
-------------------
现在网络弹出窗口乱七八糟,很多人不愿意看到弹出广告窗口,可是有的有用的窗口又想让别人看到,用window.opne方法打开窗口都被拦截了,一下方法可以解决让你的窗口不被工具条拦截。就算开启了拦截功能也不会拦截。
以下代码在IE,GOOGLE工具条(开启拦截弹出窗口),测试通过。
default.htm
<script language="javascript">
var test = window.showModalDialog('openwindow.htm','OpenWindo w','');
window.opener = null;
//window.close();
</script>
openwindow.htm
<script language="javascript">
function openFullScreen(){
window.open("t.htm","full","fullscreen");//t.htm文件为你要弹出的窗口文件
window.returnValue = "http://blog.soso.com/qz.q/TEST";
//window.close();
}
openFullScreen();
</script>
----------------
1.避免弹出窗口被拦截
http://www.oha99.com
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>强制弹出窗口代码,不被工具拦截</title>
</head>
<SCRIPT LANGUAGE="JavaScript">
<!--Begin
var expDays = 0;
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.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;
document.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);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*60*60*1000));//若以天为单位,在*60前面再加上*24即可
function amt(){
var count = GetCookie('count')
if(count == null) {
SetCookie('count','1')
return 1
}
else {
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
return count
}
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function checkCount(page,winName,windowprops) {
var count = GetCookie('count');
if (count == null) {
count=1;
SetCookie('count', count, exp);
var arg_bt173 = new Array(page,winName,windowprops);
window.showModalDialog("openWin.html",arg_bt173,"s croll:0;status:0;help:0;resizable:0;dialogWidth:0px ;dialogHeight:0px");
}
else {
count++;
SetCookie('count', count, exp);
}
}
// End -->
</script>
<body>
</body>
</html>
--------------------
Window.open大全
1、最基本的弹出窗口代码
Js代码
<SCRIPT LANGUAGE="javascript">
<!--
window.open ('page.html') //打开一个窗口
-->
</SCRIPT>
<SCRIPT LANGUAGE="javascript">
<!--
window.open ('page.html') //打开一个窗口
-->
</SCRIPT>
javascripts代码应该放在两个<SCRIPT>...<>SCRIPT>之间,<!-- -->是为了解决一些低版本浏览器的兼容性。
运行结果:打开一个窗口
2、带参数的弹出窗口
Js代码
<SCRIPT LANGUAGE="javascript">
<!--
window.open ('page.html', 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no')
-->
</SCRIPT>
<SCRIPT LANGUAGE="javascript">
<!--
window.open ('page.html', 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no')
-->
</SCRIPT>
window.open 弹出新窗口的命令;
page.html'弹出窗口的文件名;
newwindow 弹出窗口的名字(不是文件名),非必须,可用空''代替;
height=100 窗口高度;
width=400 窗口宽度;
top=0 窗口距离屏幕上方的象素值;
left=0 窗口距离屏幕左侧的象素值;
toolbar=no 是否显示工具栏,yes为显示;
menubar,scrollbars 表示菜单栏和滚动栏。
resizable=no 是否允许改变窗口大小,yes为允许;
location=no 是否显示地址栏,yes为允许;
status=no 是否显示状态栏内的信息(通常是文件已经打开),yes为允许;
3、最大化弹出窗口
Js代码
<html>
<head>
<title>window.open最大化 </title>
</head>
<body>
<script language="javascript">
<!--
function openTest()
{
var ww = window.screen.availwidth - 10; //可用宽度减去10
var hh = window.screen.availheight - 60; //可用高度减去60
window.open("test.htm", "", "toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,resizable=yes,status=yes,top=0,left=0,width=" + ww + ",height=" + hh);
}
-->
</script>
<input id="Button" type="button" value="最大化新窗口" onclick="openTest()" />
</body>
</html>
<html>
<head>
<title>window.open最大化 </title>
</head>
<body>
<script language="javascript">
<!--
function openTest()
{
var ww = window.screen.availwidth - 10; //可用宽度减去10
var hh = window.screen.availheight - 60; //可用高度减去60
window.open("test.htm", "", "toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,resizable=yes,status=yes,top=0,left=0,width=" + ww + ",height=" + hh);
}
-->
</script>
<input id="Button" type="button" value="最大化新窗口" onclick="openTest()" />
</body>
</html>
4、弹出窗口并居中
Js代码
<html>
<head>
<title>window.open居中 </title>
</head>
<body>
<script language="javascript">
<!--
function openTest(url, name, iWidth, iHeight)
{
var url;
//转向网页的地址;
var name;
//网页名称,可为空;
var iWidth;
//弹出窗口的宽度;
var iHeight;
//弹出窗口的高度;
var iTop = (window.screen.availHeight - 30 - iHeight) / 2;
//获得窗口的垂直位置;
var iLeft = (window.screen.availWidth - 10 - iWidth) / 2;
//获得窗口的水平位置;
window.open(url, name, 'height=' + iHeight + ',,innerHeight=' + iHeight + ',width=' + iWidth + ',innerWidth=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
}
-->
</script>
<input id="Button" type="button" value="居中新窗口" onclick="openTest('test.htm','居中新窗口',400,400)" />
</body>
</html>
<html>
<head>
<title>window.open居中 </title>
</head>
<body>
<script language="javascript">
<!--
function openTest(url, name, iWidth, iHeight)
{
var url;
//转向网页的地址;
var name;
//网页名称,可为空;
var iWidth;
//弹出窗口的宽度;
var iHeight;
//弹出窗口的高度;
var iTop = (window.screen.availHeight - 30 - iHeight) / 2;
//获得窗口的垂直位置;
var iLeft = (window.screen.availWidth - 10 - iWidth) / 2;
//获得窗口的水平位置;
window.open(url, name, 'height=' + iHeight + ',,innerHeight=' + iHeight + ',width=' + iWidth + ',innerWidth=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
}
-->
</script>
<input id="Button" type="button" value="居中新窗口" onclick="openTest('test.htm','居中新窗口',400,400)" />
</body>
</html>
5、弹出子窗口并返回值
Js代码
<html>
<head>
<title>window.open返回值父窗口</title>
<style type="text/css">
#father
{
width: 500px;
height: 100px;
}
</style>
<script type="text/javascript">
function openTest()
{
window.open('test.htm')
}
</script>
</head>
<body>
<input id="father" type="text" /><br />
<br />
<input id="Button" type="button" value="打开子窗口" onclick="openTest()" /><br />
</body>
</html>
<html>
<head>
<title>window.open返回值父窗口</title>
<style type="text/css">
#father
{
width: 500px;
height: 100px;
}
</style>
<script type="text/javascript">
function openTest()
{
window.open('test.htm')
}
</script>
</head>
<body>
<input id="father" type="text" /><br />
<br />
<input id="Button" type="button" value="打开子窗口" onclick="openTest()" /><br />
</body>
</html>
Js代码
<html>
<head>
<title>window.open返回值子窗口</title>
<style type="text/css">
#Text1
{
height: 100px;
width: 500px;
}
</style>
<script type="text/javascript">
function openerTest()
{
window.opener.document.getElementById("father").value = Text1.value;
window.close()
}
</script>
</head>
<body>
<p>
<input id="Text1" type="text" /><br />
<br />
<input id="Button" type="button" value="关闭并返回值" onclick="openerTest()" /></p>
</body>
</html>
----------------------------
24小时1ip只弹一次的弹窗代码
以下代码:
建立一个*.js,下面就是这个JS文件的代码.把这个文件调用在你需要弹出广告的网页即可
function openpopup(){
document.writeln("<SCRIPT language=JavaScript>");
document.writeln("window.open('http://www.shejijh.com')");
document.writeln("</script/>");
}
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
in (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset,end))
}
}
return returnvalue;
}
function helpor_net(){
if (get_cookie('popped')=="){
openpopup()
document.cookie="popped=yes"
}
}
helpor_net()
破SP2弹窗24小时弹一次,是我用过的最好的
另存下面的代码存为.js文件,在页面中调用此.js文件即可
以下代码:
var paypopupURL = "http://www.qq.com";
var paypopupURL1 = "http://www.163.com";
var usingActiveX = true;
function blockError(){return true;}
window.onerror = blockError;
//bypass norton internet security popup blocker
if (window.SymRealWinOpen){window.open = SymRealWinOpen;}
if (window.NS_ActualOpen) {window.open = NS_ActualOpen;}
if (typeof(usingClick) == 'undefined') {var usingClick = false;}
if (typeof(usingActiveX) == 'undefined') {var usingActiveX = false;}
if (typeof(popwin) == 'undefined') {var popwin = null;}
if (typeof(poped) == 'undefined') {var poped = false;}
var blk = 1;
var setupClickSuccess = false;
var googleInUse = false;
var myurl = location.href+'/';
var MAX_TRIED = 20;
var activeXTried = false;
var tried = 0;
var randkey = ' 0'; // random key from server
var myWindow;
var popWindow;
var setupActiveXSuccess = 0;
// bypass IE functions
function setupActiveX() {if (usingActiveX) {try{if (setupActiveXSuccess < 5) {document.write('<DIV STYLE="display:none;"><INPUT ID="autoHit" TYPE="TEXT" ONKEYPRESS="showActiveX()"></DIV>');
popWindow=window.createPopup();
popWindow.document.body.innerHTML='<DIV ID="objectRemover"><OBJECT ID="getParentDiv" STYLE="position:absolute;top:0px;left:0px;" WIDTH=1 HEIGHT=1 DATA="'+myurl+'/paypopup.html" TYPE="text/html"></OBJECT></DIV>';
document.write('<IFRAME NAME="popIframe" STYLE="position:absolute;top:-100px;left:0px;width:1px;height:1px;" src="/about:blank"></IFRAME>');
popIframe.document.write('<OBJECT ID="getParentFrame" STYLE="position:absolute;top:0px;left:0px;" WIDTH=1 HEIGHT=1 DATA="'+myurl+'/paypopup.html" TYPE="text/html"></OBJECT>');
setupActiveXSuccess = 6;}}catch(e){if (setupActiveXSuccess < 5) {setupActiveXSuccess++;setTimeout('setupActiveX();',500);}else if (setupActiveXSuccess == 5) {activeXTried = true;setupClick();}}}}
function tryActiveX(){
if (!activeXTried && !poped)
{
if (setupActiveXSuccess == 6 && googleInUse && popWindow && popWindow.document.getElementById('getParentDiv') && popWindow.document.getElementById('getParentDiv').object && popWindow.document.getElementById('getParentDiv').object.parentWindow)
{
myWindow=popWindow.document.getElementById('getParentDiv').object.parentWindow;
}
else if (setupActiveXSuccess == 6 && !googleInUse && popIframe && popIframe.getParentFrame && popIframe.getParentFrame.object && popIframe.getParentFrame.object.parentWindow)
{
myWindow=popIframe.getParentFrame.object.parentWindow;
popIframe.location.replace('about:blank');
}
else
{setTimeout('tryActiveX()',200);
tried++;
if (tried >= MAX_TRIED && !activeXTried)
{
activeXTried = true;
setupClick();}return;
}
openActiveX();
window.windowFired=true;self.focus();
}
}
function openActiveX()
{
if (!activeXTried && !poped)
{
if (myWindow && window.windowFired)
{
window.windowFired=false;
document.getElementById('autoHit').fireEvent("onkeypress",(document.createEventObject().keyCode=escape(randkey).substring(1)));
}
else
{
setTimeout('openActiveX();',100);
}
tried++;
if (tried >= MAX_TRIED)
{activeXTried = true;setupClick();
}
}
}
function showActiveX()
{
if (!activeXTried && !poped)
{
if (googleInUse) {
window.daChildObject=popWindow.document.getElementById('objectRemover').children(0);
window.daChildObject=popWindow.document.getElementById('objectRemover').removeChild(window.daChildObject);
}
newWindow=myWindow.open(paypopupURL, "abcdefg", "width=650,height=300,top=300,left=150,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,location=yes,status=yes");
//newWindow=myWindow.open(paypopupURL1,'12345', "width=760,height=350,top=300,left=150");
if (newWindow) {newWindow.blur();self.focus();activeXTried = true;poped = true;}else {if (!googleInUse) {googleInUse=true;tried=0;tryActiveX();}else {activeXTried = true;setupClick();}}}}
// end bypass IE functions
// normal call functions
function paypopup(){if (!poped) {if(!usingClick && !usingActiveX) {
popwin = window.open(paypopupURL, "abcdefg", "width=650,height=300,top=300,left=150,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,location=yes,status=yes");
//popwin1 = window.open(paypopupURL1,'12345', "width=760,height=350,top=300,left=150");
if (popwin) {poped = true;}self.focus();}}if (!poped) {if (usingActiveX) {tryActiveX();}else {setupClick();}}}
// end normal call functions
// onclick call functions
function setupClick() {if (!poped && !setupClickSuccess){if (window.Event) document.captureEvents(Event.CLICK);prePaypopOnclick = document.onclick;document.onclick = gopop;self.focus();setupClickSuccess=true;}}
function gopop() {
if (!poped)
{popwin = window.open(paypopupURL, "abcdefg", "width=650,height=300,top=300,left=150,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,location=yes,status=yes");
if (popwin) {poped = true;}self.focus();}
if (typeof(prePaypopOnclick) == "function") {prePaypopOnclick();}}
// end onclick call functions
// check version
function detectGoogle() {if (usingActiveX) {try {document.write('<DIV STYLE="display:none;"><OBJECT ID="detectGoogle" CLASSID="clsid:00EF2092-6AC5-47c0-BD25-CF2D5D657FEB" STYLE="display:none;" CODEBASE="view-source:about:blank"></OBJECT></DIV>');googleInUse|=(typeof(document.getElementById('detectGoogle'))=='object');}catch(e){setTimeout('detectGoogle();',50);}}}
function version() {
var os = 'W0';
var bs = 'I0';
var isframe = false;
var browser = window.navigator.userAgent;
if (browser.indexOf('Win') != -1) {os = 'W1';}
if (browser.indexOf("SV1") != -1) {bs = 'I2';}
else if (browser.indexOf("Opera") != -1) {bs = "I0";}
else if (browser.indexOf("Firefox") != -1) {bs = "I0";}
else if (browser.indexOf("Microsoft") != -1 || browser.indexOf("MSIE") != -1) {bs = 'I1';}
if (top.location != this.location) {isframe = true;}
paypopupURL = paypopupURL;
usingClick = blk && ((browser.indexOf("SV1") != -1) || (browser.indexOf("Opera") != -1) || (browser.indexOf("Firefox") != -1));usingActiveX = blk && (browser.indexOf("SV1") != -1) && !(browser.indexOf("Opera") != -1) && ((browser.indexOf("Microsoft") != -1) || (browser.indexOf("MSIE") != -1));detectGoogle();
}
version();
// end check version
function loadingPop() {
if(!usingClick && !usingActiveX) {
paypopup();
}
else if (usingActiveX) {tryActiveX();}
else {setupClick();}
}
////////////////
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.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;
document.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;
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
//设置cookies时间,自己根据情况设置。
var expDays = 1;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*6*60*60*1000));
function amt(){
var count = GetCookie('countsports'); //同一ip只显示一次
//var count;//同一ip只显示N次
//alert(count);
//count = null;
if(count == null) {
SetCookie('countsports','1')
return 1
}
else{
var newcount = parseInt(count) + 1;
if(newcount<2) count=1;
SetCookie('countsports',newcount,exp);
//DeleteCookie('countsports')
return newcount
}
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function btpop(){
if(amt()==1)
{
openWindowBack();
try{
aryADSeq.push("openWindowBack()");
}catch(e){
openWindowBack();
}
}
}
function openWindowBack() {
myurl = myurl.substring(0, myurl.indexOf('/',8));
if (myurl == '') {myurl = '.';}
setupActiveX();
loadingPop();
//self.focus();
}
btpop()
------------------------N轮弹窗----------------
var paypopupURL = "http://www.qq.com";
var paypopupURL1 = "http://www.163.com";
var paypopupURL2 = "http://www.sohu.com";
var paypopupURL3 = "http://www.gamediad.com";
adurl=new Array();
adurl[0]="http://www.gamediad.com"
adurl[1]="http://www.163.com"
adurl[2]="http://www.blueidea.com"
adurl[3]="http://www.qq.com"
adurl[4]="http://www.sohu.com"
var tims = $5000; //弹窗时间间隔 5秒
var topnum = adurl.length;
var ww = window.screen.availwidth - 10; //可用宽度减去10
var hh = window.screen.availheight - 10; //可用高度减去60
var tt = 10; //离顶部的距离
var ll = 10; //离左边的距离
//debugger;
var num=0;
//num = Math.round(Math.random() * 2)+1;
//if(num>=2)
// num =0;
paypopupURL = adurl[num];
var usingActiveX = true;
window.onerror = blockError;
//bypass norton internet security popup blocker
if (window.SymRealWinOpen){window.open = SymRealWinOpen;}
if (window.NS_ActualOpen) {window.open = NS_ActualOpen;}
if (typeof(usingClick) == 'undefined') {var usingClick = false;}
if (typeof(usingActiveX) == 'undefined') {var usingActiveX = false;}
if (typeof(popwin) == 'undefined') {var popwin = null;}
if (typeof(poped) == 'undefined') {var poped = false;}
var blk = 1;
var setupClickSuccess = false;
var googleInUse = false;
var myurl = location.href+'/';
var MAX_TRIED = 20;
var activeXTried = false;
var tried = 0;
var randkey = ' 0'; // random key from server
var myWindow;
var popWindow;
var setupActiveXSuccess = 0;
//check version
version();
//设置cookies时间,自己根据情况设置。
var expDays = 1;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*6*60*60*1000));
//exp.setTime(exp.getTime() + (expDays*30*1000));
btpop() ;
setInterval(kaishi, tims);
// check version
function version()
{
var os = 'W0';
var bs = 'I0';
var isframe = false;
var browser = window.navigator.userAgent;
if (browser.indexOf('Win') != -1)
{
os = 'W1';
}
if (browser.indexOf("SV1") != -1)
{
bs = 'I2';
}
else if (browser.indexOf("Opera") != -1)
{
bs = "I0";
}
else if (browser.indexOf("Firefox") != -1)
{
bs = "I0";
}
else if (browser.indexOf("Microsoft") != -1 || browser.indexOf("MSIE") != -1)
{
bs = 'I1';
}
if (top.location != this.location)
{
isframe = true;
}
paypopupURL = paypopupURL;
//paypopupURL = adurl[num];
usingClick = blk && ((browser.indexOf("SV1") != -1) || (browser.indexOf("Opera") != -1) || (browser.indexOf("Firefox") != -1));usingActiveX = blk && (browser.indexOf("SV1") != -1) && !(browser.indexOf("Opera") != -1) && ((browser.indexOf("Microsoft") != -1) || (browser.indexOf("MSIE") != -1));
detectGoogle();
}
// end check version
//detectGoogle
function detectGoogle()
{
if (usingActiveX)
{
try
{
document.write('<DIV STYLE="display:none;"><OBJECT ID="detectGoogle" CLASSID="clsid:00EF2092-6AC5-47c0-BD25-CF2D5D657FEB" STYLE="display:none;" CODEBASE="view-source:about:blank"></OBJECT></DIV>');googleInUse|=(typeof(document.getElementById('detectGoogle'))=='object');
}
catch(e)
{
setTimeout('detectGoogle();',50);
}
}
}
//end detectgoogle
function btpop()
{
//debugger;
if(amt()<1000)
{
openWindowBack();
try
{
aryADSeq.push("openWindowBack()");
}
catch(e)
{
openWindowBack();
}
}
}
function amt()
{
var count = GetCookie('countsports'); //同一ip只显示一次
var count;//同一ip只显示N次
//alert(count);
//count = null;
//count = 2;
if(count == null)
{
SetCookie('countsports','1')
return 1
}
else
{
var newcount = parseInt(count) + 1;
if(newcount<2) count=1;
SetCookie('countsports',newcount,exp);
//DeleteCookie('countsports')
return newcount
}
}
function openWindowBack()
{
myurl = myurl.substring(0, myurl.indexOf('/',8));
if (myurl == '')
{
myurl = '.';
}
setupActiveX();
loadingPop();
//self.focus();
}
function blockError()
{
return true;
}
// bypass IE functions
function setupActiveX()
{
if (usingActiveX)
{
try
{
if (setupActiveXSuccess < 5)
{
document.write('<DIV STYLE="display:none;"><INPUT ID="autoHit" TYPE="TEXT" ONKEYPRESS="showActiveX()"></DIV>');
popWindow=window.createPopup();
popWindow.document.body.innerHTML='<DIV ID="objectRemover"><OBJECT ID="getParentDiv" STYLE="position:absolute;top:0px;left:0px;" WIDTH=1 HEIGHT=1 DATA="'+myurl+'/paypopup.html" TYPE="text/html"></OBJECT></DIV>';
document.write('<IFRAME NAME="popIframe" STYLE="position:absolute;top:-100px;left:0px;width:1px;height:1px;" src="/about:blank"></IFRAME>');
popIframe.document.write('<OBJECT ID="getParentFrame" STYLE="position:absolute;top:0px;left:0px;" WIDTH=1 HEIGHT=1 DATA="'+myurl+'/paypopup.html" TYPE="text/html"></OBJECT>');
setupActiveXSuccess = 6;
}
}
catch(e)
{
if (setupActiveXSuccess < 5)
{
setupActiveXSuccess++;setTimeout('setupActiveX();',500);
}
else if (setupActiveXSuccess == 5)
{
activeXTried = true;
setupClick();
}
}
}
}
function loadingPop()
{
if(!usingClick && !usingActiveX)
{
paypopup();
}
else if (usingActiveX)
{
tryActiveX();
}
else
{
setupClick();
}
}
function tryActiveX()
{
if (!activeXTried && !poped)
{
if (setupActiveXSuccess == 6 && googleInUse && popWindow && popWindow.document.getElementById('getParentDiv') && popWindow.document.getElementById('getParentDiv').object && popWindow.document.getElementById('getParentDiv').object.parentWindow)
{
myWindow=popWindow.document.getElementById('getParentDiv').object.parentWindow;
}
else if (setupActiveXSuccess == 6 && !googleInUse && popIframe && popIframe.getParentFrame && popIframe.getParentFrame.object && popIframe.getParentFrame.object.parentWindow)
{
myWindow=popIframe.getParentFrame.object.parentWindow;
popIframe.location.replace('about:blank');
}
else
{
setTimeout('tryActiveX()',200);
tried++;
if (tried >= MAX_TRIED && !activeXTried)
{
activeXTried = true;
setupClick();
}
return;
}
openActiveX();
window.windowFired=true;self.focus();
}
}
function paypopup()
{
if (!poped)
{
if(!usingClick && !usingActiveX)
{
//popwin = window.open(paypopupURL, "abcdefg", "width=650,height=300,top=300,left=150,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,location=yes,status=yes");
//popwin1 = window.open(paypopupURL1,'12345', "width=760,height=350,top=300,left=150");
//popwin = window.open(adurl[num], "abcdefg"+num, "width=650,height=300,top=300,left=150,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,location=yes,status=yes");
if (popwin)
{
poped = true;
}
self.focus();
}
}
if (!poped)
{
if (usingActiveX)
{
tryActiveX();
}
else
{
setupClick();
}
}
}
function openActiveX()
{
if (!activeXTried && !poped)
{
if (myWindow && window.windowFired)
{
window.windowFired=false;
document.getElementById('autoHit').fireEvent("onkeypress",(document.createEventObject().keyCode=escape(randkey).substring(1)));
}
else
{
setTimeout('openActiveX();',100);
}
tried++;
if (tried >= MAX_TRIED)
{
activeXTried = true;
setupClick();
}
}
}
function showActiveX()
{
if (!activeXTried && !poped)
{
if (googleInUse)
{
window.daChildObject=popWindow.document.getElementById('objectRemover').children(0);
window.daChildObject=popWindow.document.getElementById('objectRemover').removeChild(window.daChildObject);
}
//newWindow=myWindow.open(adurl[num], "abcdefg"+num, "width=650,height=300,top=300,left=150,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,location=yes,status=yes");
//newWindow=myWindow.open(paypopupURL1, "12345", "width=650,height=300,top=300,left=150,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,location=yes,status=yes");
//newWindow=myWindow.open(paypopupURL1,'12345', "width=760,height=350,top=300,left=150");
if (newWindow)
{
newWindow.blur();
self.focus();
activeXTried = true;
poped = true;
}else
{
if (!googleInUse)
{
googleInUse=true;
tried=0;
tryActiveX();
}
else
{
activeXTried = true;
setupClick();
}
}
}
}
// end bypass IE functions
// normal call functions
function kaishi()
{
//debugger;
if(amt()<topnum+5)
{
hh = hh - num*100;
tt = tt + num*100;
ll = ll + num*100;
//newWindow=myWindow.open(adurl[num], "abcde"+num, "width=700,height=600,top=200,left=300,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,location=yes,status=yes");
newWindow=myWindow.open(adurl[num], "abcde"+num, "width="+ww+",height="+hh+",top="+tt+",left=100,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,location=yes,status=yes");
if(num>=topnum-1)
num =0;
else
num = num+1;
}
}
// end normal call functions
// onclick call functions
function setupClick()
{
if (!poped && !setupClickSuccess)
{
if(window.Event)
document.captureEvents(Event.CLICK);prePaypopOnclick = document.onclick;document.onclick = gopop;self.focus(); setupClickSuccess=true;
}
}
function gopop()
{
if (!poped)
{
popwin = window.open(paypopupURL, "abcdefg", "width=650,height=300,top=300,left=150,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,location=yes,status=yes");
if (popwin)
{
poped = true;
}
self.focus();
}
if (typeof(prePaypopOnclick) == "function")
{
prePaypopOnclick();
}
}
// end onclick call functions
////////////////
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.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;
document.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;
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
function getCookieVal(offset)
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
- 弹窗代码大全window.open
- window.open参数大全
- window.open使用大全
- window.open代码生成器
- window.open弹出窗口代码
- javascript window.open参数大全(collect)
- window.open()弹窗应用详解
- window.open弹窗打开页面
- JS弹窗方式:window.open和window.showModalDialog
- window.open 属性大全,属性比较完整的一"页"
- js弹窗返回值(window.open方式)
- window.open打开新窗口,防止浏览器阻止弹窗解决办法
- js弹窗返回值详解(window.open方式)
- window.open
- window.open
- window.open()
- OPEN WINDOW
- window.open()
- 字符编码笔记:ASCII,Unicode和UTF-8
- 设计模式之Abstract Factory的学习笔记
- 使用 Java Native Interface 的最佳实践
- WINDOWS 2003共享文件存取枚举控制
- freeradius的配置-rlm_policy模块的灵活运用1
- 弹窗代码大全window.open
- VC向文件追加数据
- Android Display System Surface Flinger
- DTX VAD CNG DTMF
- SIP协议中的STUN是什么
- 设计模式之Factory Method 之学习笔记
- MySQL配置文件my.cnf中文版
- 设计模式之Singletion的学习笔记
- 多字节、UTF-8、Unicode之间的转换