JavaScript提醒/自动提交

[ 2004-09-09 00:42:28 | Author: zhenhua ]
Font Size: Large | Medium | Small
<SCRIPT LANGUAGE="JavaScript">
<!--
var time="3600";
var atime="300";
var etime="0";
function count(){
 setTimeout("count()",1000);
 document.form1.rest.value=format(Math.floor(time/60))+"分:"+format(time%60)+"秒";
 time--;
 if(time==atime){
 alert("还剩5分钟");
 }
 if(time==etime-1){
 alert("时间到,已经自动提交");
 document.form1.submit();
 }
}

function format(time){
 var len=time.toString().length;
 for(i="0";i<2-len;i++){
 time+="0";
 }
 return time;
}

//-->
</SCRIPT>
<form action="xx.php" method="post" name="form1">
<INPUT TYPE="button" Value="开始" onClick="count()">
<INPUT TYPE="text" NAME="rest" Value="60分:00秒">
</form>

Comments Feed Comments Feed: http://www.zhenhua.org/feed.asp?q=comment&id=163
UTF-8 Encoding Trackback URL: http://www.zhenhua.org/trackback.asp?id=163

View Mode: Show All | Comments: 1 | Trackbacks: 0 | Toggle Order | Views: 13233
1
Quote iyz043*
[ 2007-08-18 20:09:11 ]
你好。我也想开一个博客,程序那里下载的啊。
1

If you feel this site you find this information helpful, please click on the donation, which is voluntary,Thank you.
Post Comment
Smilies
[arrow] [biggrin] [confused] [cool]
[cry] [eek] [evil] [exclaim]
[frown] [idea] [lol] [mad]
[mrgreen] [neutral] [question] [razz]
[redface] [rolleyes] [sad] [smile]
[surprised] [twisted] [wink]
Enable UBB Codes
Auto Convert URL
Show Smilies
Hidden Comment
Username:   Password:   Register Now?
Security Code * Please Enter the Security Code