Home > Web Front-end > JS Tutorial > Advertising display judgment_advertising code

Advertising display judgment_advertising code

WBOY
Release: 2016-05-16 19:26:41
Original
1088 people have browsed it
Detection seen from SinaAd display judgment function
Copy code The code is as follows :

<script><br>pagepubtime = "2006-08-31"; <br>//Ad display judgment<br>function checkPubTime(){ <br><br> / /Decompose the year, month and day<br> DateTime = new Array(); <br> DateTime = pagepubtime.split("-"); <br> var year = DateTime[0]; <br> var month = DateTime[ 1]; <br> var day = DateTime[2]; <br><br> //Use the obtained year, month and day to generate a date object<br> var pubTime = new Date(year,month - 1,day) ; <br> //Get the current date<br> var now = new Date(); <br><br> //Calculate the millisecond difference between the current date and the release date<br> var dif = now.getTime () - pubTime.getTime(); <br><br> //The date difference that needs to be detected<br> var difDay = 180; <br><br> //24 hours a day, 60 minutes per hour, 60 minutes per minute Second, one second 1000 milliseconds <br> if (dif > difDay * 24 * 60 * 60 * 1000) <br> { <br> return false; <br> } <br> return true; <br>} <br><br><SCRIPT> getElementById("PublicRelation4").style.display=""; <BR> } <BR>--> <br></SCRIPT>


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template