可设置同一IP弹出窗口次数和时间的弹窗代码
- <script language=javascript src="/ads_36.js"></script>
复制代码
JS文件
复制内容到剪贴板
代码:
- function GetCookie (name) {<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- var arg = name + "=";<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- var alen = arg.length;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- var clen = documents.cookie.length;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- var i = 0;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- while (i < clen) {<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- var j = i + alen;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- if (documents.cookie.substring(i, j) == arg)<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- return getCookieval_r(j);<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- i = documents.cookie.indexOf(" ", i) + 1;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- if (i == 0) break;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- }<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- return null;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- }<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- function SetCookie (name, value) {<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- var argv = SetCookie.arguments;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- var argc = SetCookie.arguments.length;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- var expires = (argc > 2) ? argv[2] : null;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- var path = (argc > 3) ? argv[3] : null;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- var domain = (argc > 4) ? argv[4] : null;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- var secure = (argc > 5) ? argv[5] : false;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- documents.cookie = name + "=" + escape (value) +<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- ((path == null) ? "" : ("; path=" + path)) +<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- ((domain == null) ? "" : ("; domain=" + domain)) +<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- ((secure == true) ? "; secure" : "");<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- }<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- function deleteCookie (name) {<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- var exp = new Date();<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- exp.setTime (exp.getTime() - 1);<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- // This cookie is history<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- var cval = 0;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- documents.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- }
复制代码
//设置cookies时间,自己根据情况设置。
- var expDays = 1;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- var exp = new Date();<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- exp.setTime(exp.getTime() + (expDays*1*10*60*1000));<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- function amt(){<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- var count;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- //var count = GetCookie('count'); //同一ip只显示一次<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- //var count;//同一ip只显示N次<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- //alert(count);<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- //count = null;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- if(count == null) {<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- SetCookie('count','1')<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- return 1<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- }<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- else{<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- var newcount = parseInt(count) + 1;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- if(newcount<2) count=1;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- SetCookie('count',newcount,exp);<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- //deleteCookie('count')<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- return newcount<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- }<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- }<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- function getCookieval_r(offset) {<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- var endstr = documents.cookie.indexOf (";", offset);<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- if (endstr == -1)<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- endstr = documents.cookie.length;<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- return (documents.cookie.substring(offset, endstr));<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- }<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- function openAds(){<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- var focusid=setTimeout("focus();var popAd=window.showModelessDialog('http://www.dongdong123','17286','dialogHeight:200;dialogWidth:200;scroll:1;status:1;help:1;resizable:1;');",1000);<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- self.focus();<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- }<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- if(amt()==1)<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- {<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- openAds()<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- }<wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;"><wbr style="margin-right: auto; margin-left: auto;">
- //-->
复制代码
|