控制窗口打开日期


脚本说明:
第一步:把如下代码加入<head>区域中
<script language="JavaScript">

<!--

window.open("hi.htm", "", "scrollbars=no,resizable,height=150,width=200")

//-->

</script>



第二步:新建hi.htm文件,其内容为如下代码:
<html>
<head>
<script language="javascript"> 

function openOrClose() { 

var beginDateAndTime="200006250000" //起始时间,格式为:年,月,日,时,秒

var endDateAndTime="200008310000" //结束时间(本例设定在2000年才弹出)

var aTime = new Date()

var thisYear = aTime.getYear()

var thisMonth = aTime.getMonth() + 1

var thisDate = aTime.getDate()

var thisHour = aTime.getHours()

var thisMinute = aTime.getMinutes()

var thisDateAndTime = (thisYear*100000000)+(thisMonth*1000000)+(thisDate*10000)+(thisHour*100)+thisMinute

if (thisDateAndTime <= beginDateAndTime || thisDateAndTime >= endDateAndTime) {

self.close()

}

}

</script>
</head>
<body onload=openOrClose() bgcolor="#fef4d9">
<center>本窗口只在2000年7月份打开
<br>你可以任意更改时间设置
</center>