很好的三个弹窗代码

| No Comments | No TrackBacks

进弹第一种
这个用的是表单自动提交的弹出方法,打开页面,自动弹出,记录了COOKIE,24小时一个IP弹一次,弹出效果不错!
如果,想换成点击页面任何处,就弹,可以将body onload=改成body onclick=

  1. <script type="text/javascript">  
  2.  document.writeln('<script type="text/javascript">');  
  3.  document.writeln('function ads(){');  
  4.  document.writeln('var Then = new Date() ');  
  5.  document.writeln('Then.setTime(Then.getTime() + 2*60*60*1000)');  
  6.  document.writeln('var cookieString = new String(document.cookie)');  
  7.  document.writeln('var cookieHeader = "andy=" ');  
  8.  document.writeln('var beginPosition = cookieString.indexOf(cookieHeader)');  
  9.  document.writeln('if (beginPosition != -1){ ');  
  10.  document.writeln('} else ');  
  11.  document.writeln('{ document.cookie = "andy=newandy;expires="+ Then.toGMTString() ');  
  12.  document.writeln('andys.submit();');  
  13.  document.writeln('window.focus();');  
  14.  document.writeln('}');  
  15.  document.writeln('}');  
  16.  document.writeln('</script>');  
  17.  document.writeln('<script type="text/javascript" event="onunload" for="window">');  
  18.  document.writeln('ads();');  
  19.  document.writeln('</script>');  
  20.  document.writeln('<body >');  
  21.  document.writeln('<form name="andys" action="http://blog.621000.net" target="_blank">');  
  22.  <script> 
效果和进弹第二种 请自行比较!进弹推荐使用这一种!
  1. <script type="text/javascript">  
  2.  <!--  
  3.  function setCookie(name, value, expire) {  
  4.  window.document.cookie = name + "=" + escape(value) + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()));  
  5.  }  
  6.    
  7.  function getCookie(Name) {  
  8.  var search = Name + "=";  
  9.  if (window.document.cookie.length > 0) { // if there are any cookies  
  10.  offset = window.document.cookie.indexOf(search);  
  11.  if (offset != -1) { // if cookie exists  
  12.  offset += search.length; // set index of beginning of value  
  13.  end = window.document.cookie.indexOf(";", offset) // set index of end of cookie value  
  14.  if (end == -1)  
  15.  end = window.document.cookie.length;  
  16.  return unescape(window.document.cookie.substring(offset, end));  
  17.  }  
  18.  }  
  19.  return null;  
  20.  }  
  21.    
  22.  function register(name) {  
  23.  var today = new Date();  
  24.  var expires = new Date();  
  25.  expires.setTime(today.getTime() + 1000*60*60*24);  
  26.  setCookie("andy", name, expires);  
  27.  }  
  28.    
  29.  function blockError(){return true;}  
  30.  window.onerror = blockError;  
  31.  if (window.SymRealWinOpen){window.open = SymRealWinOpen;}  
  32.  if (window.NS_ActualOpen) {window.open = NS_ActualOpen;}  
  33.  var usingClick = false;  
  34.  var usingObject = false;  
  35.  var usingEditor = false;  
  36.  var popwin = null;  
  37.  var poped = false;  
  38.  var paypopupURL = "http://www.im286.com";  
  39.  if (typeof(contextualAds) == 'undefined') {var c;}  
  40.  if (!document.getElementById('paypopupScriptDiv')) {document.writeln('<div id=paypopupScriptDiv style="top: 0; width: 0; height: 0; position: relative; visibility: hidden;"></div>');}  
  41.  var blk = 1;  
  42.  var setupClickSuccess = false;  
  43.  var googleInUse = false;  
  44.  var pop = 'enter';  
  45.  var myurl = document.location.protocol + "//" + document.location.host;  
  46.  var frequencyCap = '-1'//hours  
  47.  var cookieValue = 'yes';  
  48.  var cookieName = 'PayPopupAds';  
  49.  function setPayPopUpCookie() { if (frequencyCap > 0) { var today = new Date(); var expire = new Date(); expire.setTime(today.getTime() + 3600000 * frequencyCap); document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString() + "; path=/"; } else if (frequencyCap == 0) { document.cookie = cookieName+"="+escape(cookieValue) + "; path=/"; } }  
  50.  function ReadPayPopUpCookie() {var theCookie=""+document.cookie; var ind=theCookie.indexOf(cookieName); if (ind==-1 || cookieName==""return ""var ind1=theCookie.indexOf(';',ind); if (ind1==-1) ind1=theCookie.length; return unescape(theCookie.substring(ind+cookieName.length+1,ind1));}  
  51.  if (ReadPayPopUpCookie() == cookieValue){ poped=true; }  
  52.  c;  
  53.  var MAX_TRIED = 20;  
  54.  var objectTried = false;  
  55.  var tried = 0;  
  56.  var randkey = '0';  
  57.  var myWindow;  
  58.  var popWindow;  
  59.  var setupObjectSuccess = 0;  
  60.    
  61.  function setupObject() {if (usingObject) {try{if (setupObjectSuccess < 5) {var psDiv = document.getElementById('paypopupScriptDiv');if (psDiv) {psDiv.innerHTML += '<INPUT STYLE="display:none;" ID="autoHit" TYPE="TEXT" >';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="" TYPE="text/html"></OBJECT></DIV>';psDiv.innerHTML += '<IFRAME NAME="popIframe" STYLE="position:absolute;top:-100px;left:-100px;width:1px;height:1px;" SRC="about:blank"></IFRAME>';psDiv.innerHTML += '<OBJECT ID="getParentFrame" STYLE="position:absolute;top:0px;left:0px;" WIDTH=1 HEIGHT=1 DATA="" TYPE="text/html"></OBJECT>';setupObjectSuccess = 6;}else {setTimeout('setupObject();',500);}}}catch(e){if (setupObjectSuccess < 5) {setupObjectSuccess++;setTimeout('setupObject();',500);}else if (setupObjectSuccess == 5) {objectTried = true;}}}}  
  62.  function tryObject(){if (!objectTried && !poped) {if (setupObjectSuccess == 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 (setupObjectSuccess == 6 && !googleInUse && popIframe && popIframe.getParentFrame && popIframe.getParentFrame.object && popIframe.getParentFrame.object.parentWindow){myWindow=popIframe.getParentFrame.object.parentWindow;popIframe.location.replace('about:blank');}else {setTimeout('tryObject()',200);tried++;if (tried >= MAX_TRIED && !objectTried) {objectTried = true;}return;}openObject();window.windowFired=true;self.focus();}}  
  63.  function openObject(){if (!objectTried && !poped) {if (myWindow && window.windowFired){window.windowFired=false;document.getElementById('autoHit').fireEvent("onkeypress",(document.createEventObject().keyCode=escape(randkey).substring(1)));}else {setTimeout('openObject();',100);}tried++;if (tried >= MAX_TRIED) {objectTried = true;}}}  
  64.  function showObject(){if (!objectTried && !poped) {if (googleInUse) {window.daChildObject=popWindow.document.getElementById('objectRemover').children(0);window.daChildObject=popWindow.document.getElementById('objectRemover').removeChild(window.daChildObject);}if (!getPaypopupURL(window.open('about:blank','Ads1146107515' ), 1)) {if (!googleInUse) {googleInUse=true;tried=0;tryObject();}}objectTried = true;}}  
  65.  var startObjectSuccess = 0;  
  66.    
  67.  function startObject(){var psDiv = document.getElementById('paypopupScriptDiv');if (psDiv) {psDiv.innerHTML += '<div><object id="paypopupObject" width=0 height=0 classid="clsid:2D360201-FFF5-11d1-8D03-00A0C959BC0A" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="ActivateApplets" value="1"><param name="ActivateActiveXControls" value="1"></object></div>';startObjectSuccess = 6;setTimeout('popObject()', 100);}else if (startObjectSuccess < 5) {startObjectSuccess++;setTimeout('startObject();', 50);}}  
  68.  function popObject(){if (poped) {return true;}var pObj = document.getElementById('paypopupObject');var psDiv = document.getElementById('paypopupScriptDiv');if (psDiv && pObj) {try {psDiv.style.visibility = 'visible';psDiv.style.position = 'absolute';pObj.DOM.Script.execScript("function paypopupOpen() {popwin = window.open('about:blank','Ads1146107515' ); if (popwin) {popwin.blur();} return popwin;}");getPaypopupURL(pObj.DOM.Script.paypopupOpen(), 1);psDiv.style.position = 'relative';psDiv.style.visibility = 'hidden';return true;}catch(e) {setTimeout('popObject()', 200);}return false;}}  
  69.  function paypopup(){if (!poped) {if(!usingClick && !usingObject) {getPaypopupURL(window.open('about:blank','Ads1146107515' ), 0);}}if (!poped) {setupClick();if (usingObject) {tryObject();}}}  
  70.  function setupClick() {if (!poped && !setupClickSuccess){setupClickSuccess=true;if (window.Event) document.captureEvents(Event.CLICK);prePaypopOnclick = document.onclick;document.onclick = paypopupClick;self.focus();}}  
  71.  function paypopupClick(e) {if (!poped) {if (parseInt(navigator.appVersion)>3) {var leftMouseClick = 1;if (navigator.appName == "Netscape") {leftMouseClick = (e.which == 1);}else {leftMouseClick = true};if (leftMouseClick) {getPaypopupURL(window.open('about:blank','Ads1146107515' ), 2);}if (typeof(prePaypopOnclick) == "function") {prePaypopOnclick();}}}}  
  72.  function detectGoogle() {if (usingObject) {var psDiv = document.getElementById('paypopupScriptDiv');if (psDiv) {psDiv.innerHTML += '<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');}else {setTimeout('detectGoogle()', 10);}}}  
  73.  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 != self) {isframe = true;}usingClick = blk && ((browser.indexOf("SV1") != -1) || (browser.indexOf("Opera") != -1) || (browser.indexOf("Firefox") != -1));usingObject = blk && (browser.indexOf("SV1") != -1) && !(browser.indexOf("Opera") != -1) && ((browser.indexOf("Microsoft") != -1) || (browser.indexOf("MSIE") != -1));usingEditor = blk && (browser.indexOf("SV1") != -1) && !(browser.indexOf("Opera") != -1) && ((browser.indexOf("Microsoft") != -1) || (browser.indexOf("MSIE") != -1));detectGoogle();}  
  74.  version();  
  75.    
  76.  function getPaypopupURL(popwin, bk) {if (popwin) {popwin.location = paypopupURL;}  
  77.  popwin.blur();self.focus();poped=true;setPayPopUpCookie();  
  78.  return popwin;  
  79.  }  
  80.    
  81.  function loadingPop() {  
  82.    
  83.  var c = getCookie("andy");  
  84.  if (c != null) {  
  85.  return;  
  86.  }  
  87.  register("tse");  
  88.    
  89.  {if(!usingClick && !usingObject) {if (pop == "enter") {paypopup();}}else{setupClick();if (usingObject) {tryObject();}}}  
  90.  if (usingObject) {setupObject();}  
  91.  if (usingEditor) {startObject();}  
  92.    
  93.  }  
  94.    
  95.  loadingPop();  
  96.  -->  
  97.  </Script> 
最后登场的当然是我的最爱,退弹!24小时一个IP只弹一次!
  1. <script type="text/javascript">  
  2.  var nid=0;  
  3.  var tid=431;  
  4.  var mid=947;  
  5.  var full=1;  
  6.  var popDialogOptions = "dialogWidth:800px; dialogHeight:600px; dialogTop:0px; dialogLeft:0px; edge:Raised; center:0; help:0; resizable:1; scroll:1; status:0";  
  7.  var popWindowOptions = "scrollbars=1,menubar=0,toolbar=0,location=0,personalbar=0,status=0,resizable=1";  
  8.  var doexit = true;  
  9.  var usePopDialog = true;  
  10.  var isUsingSpecial = false;  
  11.  function loadpopups(){  
  12.  if(doexit && !isUsingSpecial) {  
  13.  doexit = false;  
  14.  window.open(popURL1,"",popWindowOptions);  
  15.  }  
  16.  }  
  17.  var isXPSP2 = false;  
  18.  var u = "6BF52A52-394A-11D3-B153-00C04F79FAA6";  
  19.  var str_url;  
  20.  str_url = window.location.search;  
  21.  function ext()  
  22.  {  
  23.  if(doexit)  
  24.  {  
  25.  doexit=false;  
  26.    
  27.  if(!isXPSP2 && !usePopDialog)  
  28.  {  
  29.  window.open(popURL1,"",popWindowOptions);  
  30.  }  
  31.  else if(!isXPSP2 && usePopDialog)  
  32.  {  
  33.  eval("window.showModalDialog(popURL1,'',popDialogOptions)");  
  34.  }  
  35.  else  
  36.  {  
  37.  iie.launchURL(popURL1);  
  38.  }  
  39.  }  
  40.  }  
  41.  function brs()  
  42.  {  
  43.  document.body.innerHTML+="<object id=iie width=0 height=0 classid='CLSID:"+u+"'></object>";  
  44.  }  
  45.  function ver()  
  46.  {  
  47.  isXPSP2 = (window.navigator.userAgent.indexOf("SV1") != -1);  
  48.  if(isXPSP2) brs();  
  49.  }  
  50.    
  51.  var popURL1 = 'http://www.im286.com';  
  52.    
  53.  isUsingSpecial = true;  
  54.    
  55.  var Then = new Date();  
  56.  Then.setTime(Then.getTime() + 2*60*60*1000);  
  57.  var cookieString = new String(document.cookie);  
  58.  var cookieHeader = "andy=";  
  59.  var beginPosition = cookieString.indexOf(cookieHeader);  
  60.    
  61.  if (str_url.indexOf("2005")!=-1 ||str_url.indexOf("2006")!=-1 ||str_url.indexOf("2007")!=-1 || beginPosition != -1)  
  62.  {  
  63.  }  
  64.  else  
  65.  {  
  66.  document.cookie = "andy=newandy;expires="+ Then.toGMTString();  
  67.  eval("window.attachEvent('onload',ver);");  
  68.  eval("window.attachEvent('onunload',ext);");  
  69.  }  
  70.  </script>  

No TrackBacks

TrackBack URL: http://www.wujianrong.com/mt-tb.cgi/2476

Leave a comment

相关文档

上一篇:让你的Smarty更聪明 .

下一篇:2007年最新web2.0开源程序代码集合