判断网页是否过期 getTime()
用于实现广告过期
<head>
<h>判断网页是否过期</h>
<hr>
<script>
<!
today = new Date() //取得现在的时间
TheDay = new Date() //取得结束的时间 // ::
//如果 todaygetTime() > TheDaygetTime()
if (todaygetTime()>TheDaygetTime())
{
documentwrite(<h>抱歉你访问的网页已经过期!</h>) }
else
{
documentwrite(<font size=>你的网页尚未过期</font>)
}
//>
</script>
在线时钟实例 setTimeout()函数
<head>
<script>
<!
function showtime()
{
documentCLOCKALarmvalue = new Date()toString()
TimerID = setTimeout(showtime())
}
//>
</script>
</head>
<body onLoad=showtime()>
<Form name=CLOCK>
<input name=ALarm type=text size= value=>
如无效果请刷新
</form>
</body>
其中:setTimeout()函数
TimerID = setTimeout(showtime)
通过setTimeout 来刷新时间 间隔=秒
status window自带函数状态栏提示
<html>
<head>
<meta httpequiv=ContentType content=text/html; charset=gb>
<title>无标题文档</title>
<script>
<!
windowdefaultStatus=这里是主页
//>
</script>
</head>
<body>
<a onmouseover=windowstatus=;return true>abc</a><br>
<a onmouseover=windowstatus=;return true>def</a>
</body>
</html>
setTimeout 函数自动链向新网站
<html>
<head>
<meta httpequiv=ContentType content=text/html; charset=gb>
<script language=JavaScript>
<!
function Redir()
{
a = //在此输入新网站的网址
TimerID=setTimeout(windowlocation)
}
//>
</script>
</head>
<body onload=Redir()>
我们的网站搬新家了!请单击下面的超链接进入我们的新网站<br>
<a >网页陶吧</a>
<br> 秒后自动进入新的网站请耐心等待
</body>
</html>
广告字幕实例
<head>
<script>
<!
var ShowString =
+SpaceThe final frontier These are the
+voyages of the Starship Enterprise its
+continuing mission: to explore strange
+new worlds to seek out new life and new
+civilizatins to boldly go where no man
+has gone before______________________________
+宇宙人类的最终边界太空船企业号的旅程
+是为了探索陌生新世界找寻新生命与新文明勇
+驶向人类足迹从未的领域
//
var ShowWidth =
var ShowHead =
var ShowTail = ShowWidth
var ShowLength= ShowStringlength
//
function marquee()
{
var DisplayString
if (ShowHead<ShowTail)
DisplayString = ShowStringsubstring(ShowHeadShowTail)
else
DisplayString = ShowStringsubstring(ShowHeadShowLength)
+ShowStringsubstring( ShowTail)
//
ShowHead = (ShowHead + ) % ShowLength
ShowTail = (ShowTail + ) % ShowLength
//
documentRUNNINGSHOWPADvalue = DisplayString
//
TimerID = setTimeout(marquee())
}
//>
</script>
</head>
<body onload=marquee()>
<center>
<form name=RUNNING>
<INPUT NAME=SHOWPAD size= Type=text value=>
如无效果请刷新
</form>
</center>
</body>
说明:
设置秒后再次调用MARQUEE()函数
TimerID = setTimeout(marquee())
广告字幕触发事件
<body onload=marquee()>