»
EnglishFrenchVietnamese

Print - Time Out - JavaScriptBank.com

Full version: jsB@nk » Form » Time Out
URL: https://www.javascriptbank.com/time-out.html

Time Out © JavaScriptBank.comLimit the time allowed for form input with this short script. Easy!

Full version: jsB@nk » Form » Time Out
URL: https://www.javascriptbank.com/time-out.html



JavaScript
<SCRIPT LANGUAGE="JavaScript">// Sergio Mottura (sergio1@onebox.com)<!-- Beginvar i = 0;var done = 0;var totalSecs = 10;function SecondPast() {if(totalSecs != null) timerId = setTimeout("SecondPast()", 1000);if(i < totalSecs) {i += 1;document.clock.seconds.value = totalSecs - i;   }}function doSub() {if(i < totalSecs) {done = true;}else {alert("Sorry, you exceeded the time limit.");done = false;}return done;}//  End --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onLoad="SecondPast()"><form name="clock" onSubmit="return doSub();">Time Remaining: <input type=text name="seconds" value="0" size=6><br><br><input type=textbox name="info" value="Test to submit"><input type=submit value="Submit"></form></BODY><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->