js 计时脚本

Time:
<SCRIPT LANGUAGE="JavaScript">
var ms = 0;
var state = 0;
function startstop() {
if (state == 0) {
state = 1;
then = new Date();
then.setTime(then.getTime() - ms);
} else {
state = 0;
now = new Date();
ms = now.getTime() - then.getTime();
document.stpw.time.value = ms;
}
}//牛图库JS特效,http://js.niutuku.com/
function swreset() {
state = 0;
ms = 0;
document.stpw.time.value = ms;
}
function display() {
setTimeout("display();", 50);
if (state == 1) {now = new Date();
ms = now.getTime() - then.getTime();
document.stpw.time.value = ms;
}
}//牛图库JS特效,http://js.niutuku.com/
window.onload=display
</SCRIPT>
<CENTER>
<a href="http://js.niutuku.com">牛图库JS特效</a>,站长必备的高质量网页特效和广告代码。,站长js特效。<hr>
<!--欢迎来到牛图库JS特效,我们网站收集大量高质量js特效,提供许多广告代码下载,网址:www.niutuku.com/,用牛图库打造靓站-->
<FORM NAME="stpw">
Time:
<INPUT TYPE="text" Name="time">
<INPUT TYPE="BUTTON" Name="ssbutton" VALUE="Start/Stop" onClick="startstop()">
<INPUT TYPE="BUTTON" NAME="reset" VALUE="Reset" onClick="swreset()">
</FORM>
</CENTER>


转自:http://www.niutuku.com/js/201008/84584/

posted @ 2012-03-12 11:38  kumat  阅读(1137)  评论(0编辑  收藏  举报