当前位置: 首页 > 图文教程 > 网络编程 > Javascript > 广告显示判断

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 广告显示判断


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 176 ::
收藏到网摘: n/a

从新浪看到的检测广告显示判断函数
复制代码 代码如下:

<script>
pagepubtime = "2006-08-31";
//广告显示判断
function checkPubTime(){
//分解年、月、日
DateTime = new Array();
DateTime = pagepubtime.split("-");
var year = DateTime[0];
var month = DateTime[1];
var day = DateTime[2];
//用得到的年、月、日生成日期对象
var pubTime = new Date(year,month - 1,day);
//得到当前日期
var now = new Date();
//计算出当前日期与发布日期之间的毫秒差值
var dif = now.getTime() - pubTime.getTime();
//需要检测的日期差
var difDay = 180;
//一天24小时、一小时60分、一分60秒、一秒1000毫秒
if (dif > difDay * 24 * 60 * 60 * 1000)
{
return false;
}
return true;
}
<SCRIPT>
//<!--广告发布-->
<!--
if (checkPubTime())
{
document.getElementById("PublicRelation4").style.display="";
}
-->
</SCRIPT>