Example
The code is as follows |
Copy Code |
<script> Determine if the date is greater than today, such as Islaterdate ("2014-10-1") returns True function Islaterdate (d) { try{ var now = new Date (); var Datearr = D.split ("-"); var arrlen = datearr.length; Now.setfullyear (Now.getyear (), Now.getmonth (), now.getdate ()); var checkdate = new Date (); Checkdate.setfullyear (Datearr[0], datearr[1]-1, datearr[2]); var nowtime = Now.gettime (); var checktime = Checkdate.gettime (); if (Nowtime < Checktime) { return true; }else{ return false; } }catch (e) {return false;} } if ((location.href== "/" | | location.href== "http://www.111cn.net/") && islaterdate ("2014-10-1")) {window.open ("/include/ad.html", "Carnival of 11", "height=400,width=400,left=" + (screen.availwidth-400)/2 + ", top=" + ( screen.availheight-400)/2 + "; Toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no"); </script> |
This will pop-up ads in the specified time range, and of course, as with Cookies server script can be set, the following way to see a cookie
The code implements a window that pops up every 24 hours:
The code is as follows |
Copy Code |
function Openpopup () { Document.writeln (" <script language=javascript>"); Document.writeln ("window.open" ( ' Http://www.111cn.net ') "); Document.writeln ("</script\>"); } Function Get_cookie (name) { var search = name + "=" var returnvalue = ""; if (Document.cookie.length > 0) { offset = document.cookie.indexOf (search) if (offset!=-1) { offset = se Arch.length End = Document.cookie.indexOf ('; ', offset); if (end = = 1) end = Document.cookie.length; Retur Nvalue=unescape (document.cookie.substring (offset, end)) } return returnvalue; } Function ninedns_com () { if (Get_cookie (' popped ') = = ') { Openpopup () document.cookie= ' Popped=yes ' } } Ninedns_com () |