当前位置:首页 > 设计在线 > 平面动画 > Photoshop > 推荐几个JS实例:时钟广告跳转状态栏等

推荐几个JS实例:时钟广告跳转状态栏等

点击次数:29 次 发布日期:2008-11-21 11:46:35 作者:源代码网
源代码网推荐

源代码网整理以下  大家自己运行看看吧。

源代码网整理以下  1、判断网页是否过期 getTime()

源代码网整理以下  用于实现广告过期。

源代码网整理以下<head>
<h1>判断网页是否过期</h1>
<hr>
<script>
<!--
today = new Date() //取得现在的时间
TheDay = new Date(2005,12,31) //取得结束的时间 2006/1/4 00:00:00
//如果 today.getTime() > TheDay.getTime()
if (today.getTime()>TheDay.getTime())
{
document.write("<h1>抱歉,你访问的网页已经过期!</h1>") }
else
{
document.write("<font size=5>你的网页尚未过期.</font>")
}
//-->
</script>

源代码网整理以下   2、在线时钟实例 setTimeout()函数

源代码网整理以下  setTimeout()函数
  TimerID = setTimeout("showtime",1000)
  通过setTimeout 来刷新时间 间隔1000=1秒

源代码网整理以下<head>
<script>
<!--
function showtime()
{
 document.CLOCK.ALARM.value = new Date().toString()
 TimerID = setTimeout("showtime()",1000)
}
//-->
</script>
</head>
<body onLoad="showtime()">
<Form name="CLOCK">
<input name="ALARM" type="text" size="45" value="">
如无效果请刷新
</form>
</body>

源代码网供稿.
网友评论 (0)
会员中心
设计在线
本站推荐
设计在线之精华