| 项目搜索 |
| |
|
代码片段库:
查看代码片段
浏览
| 提交新的代码片段
| 创建代码包
定时出现的信息
|
类型:
Full Script |
类别:
HTML Manipulation
|
许可证:
GNU General Public License |
语言:
JavaScript
|
描述:
一段文字信息在特定的时间段内显示,这个用得好是非常实用的
|
该代码片段的版本系列:
片段ID |
下载版本 |
提交时间 |
提交人 |
删除 |
4676 | 1.0 | 2003-10-13 23:21 | cbd001 | |
点击"下载版本"来下载该代码片段.
最新版本的代码片段: 1.0
脚本说明:
把如下代码加入<body>区域中
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
// Set the dates below
var goLiveDate = "20011015";
var expireDate = "20101015";
var expireYear = expireDate.substring(0,4)
var expireMonth = expireDate.slice(4,-2)
var expireDay = expireDate.slice(6)
var liveYear = goLiveDate.substring(0,4)
var liveMonth = goLiveDate.slice(4,-2)
var liveDay = goLiveDate.slice(6)
var nowDate = new Date();
var day = nowDate.getUTCDate();
var month = nowDate.getUTCMonth();
var month1 = month + 1;
if (month1 < 10)
{
month1 = "0" + month1;
}
if (day < 10)
{
day = "0" + day;
}
var year = nowDate.getYear();
var GMTdate = year + "" + month1 + "" + day
if ((GMTdate < expireDate) && (GMTdate >= goLiveDate))
{
// Insert the text you want displayed below
document.write("<div align='center'><b>这些信息将在 " + liveMonth + "/" + liveDay + "/" + liveYear + "开始显示,<br>在 " + expireMonth + "/" + expireDay + "/" + expireYear +"会自动消失.</b></div>")
}
// End -->
</script>
如果您修改了一个代码片段并且觉得很应该让别人共享,您可以把这作为这个代码片段的最新版本提交上来. |
|