如何用vbscript做一个在页面上动态显示时间的程序啊

来源:百度知道 编辑:UC知道 时间:2024/05/06 10:38:48
能不能仔细一点
做出来最好
高分回报,还有加分!!!!!

下面这个代码是显示一个按钮,按钮上显示当前时间,点击显示停留时间。

<script language="vbscript">
dim stt,edt
sub disp_clock()
dim hr,sx,hrs,curtime
hr=hour(time)
if hr<12 then
hrs=cstr(hr)
sx=" am"
else
hrs=cstr(hr-12)
sx=" pm"
end if
curtime=hrs+right(cstr(time),6)
yt.value=curtime+sx
call settimeout("disp_clock()",1000)
end sub

sub disp_msg()
dim hr,mn,sc,hrs,mns
edt=time
hr=hour(edt)
mn=minute(edt)
sc=second(edt)-second(stt)
if sc<0 then
sc=60+sc
mn=mn-1
end if
mn=mn-minute(stt)
if mn<0 then
mn=60+mn
hr=hr-1
end if
hr=hr-hour(stt)
if hr<0 then hr=24+hr
hrs=" "+cstr(hr)+"小时"
if hr=0 then hrs=""
mns=cstr(mn)+"分钟"
if mn=0 then mns=""
msgbox "你在本网页已停留了"+hrs+mns+cstr(sc)+"秒!"
end sub