Detection advertisement display judgment function seen from Sina
CopyCode The Code is as follows: <SCRIPT>
Pagepubtime = "2006-08-31 ";
// Ad display judgment
Function checkpubtime (){
// Year, month, and day
Datetime = new array ();
Datetime = pagepubtime. Split ("-");
VaR year = datetime [0];
VaR month = datetime [1];
VaR day = datetime [2];
// Use the year, month, or day to generate a date object.
VaR pubtime = new date (year, month-1, Day );
// Obtain the current date
VaR now = new date ();
// Calculate the millisecond difference between the current date and the release date
VaR DIF = now. gettime ()-pubtime. gettime ();
// Date difference to be detected
VaR difday = 180;
// 24 hours per day, 60 minutes per hour, 60 seconds per minute, 1000 milliseconds per second
If (DIF> difday * 24*60*60*1000)
{
Return false;
}
Return true;
}
<SCRIPT>
// <! -- Advertisement publishing -->
<! --
If (checkpubtime ())
{
Document. getelementbyid ("publicrelation4"). style. Display = "";
}
-->
</SCRIPT>