Beep
07-24-2002, 04:59 PM
New, but I've used this reset method successfully:
onClick = document.form.name.value=""
(from JSKit) but somehow it doesn't work in the code below -- values keep re-appearing in two text boxes. Is there something about the script itself as I've modified it that is the problem? The timer and counter work fine, the reset button does not. I've placed the script inside the <body> tags because I want to put the counter and reset buttons inside a page with other scripts once they're done. Thanks.
<body bgcolor="#FFFFFF">
<script language="JavaScript">
<!--
//on-screen timer
//JavaScriptKits at http://www.javascriptkit.com/
//modified by Bob Higgins
var c=0;
document.go.timer.value="";
function count()
{
document.go.timer.value=c;
c=c+1;
if (c>5){
document.go.timer.value=5;
document.go.txtMsg.value=("TIME IS UP!!!");
document.close();
}
setTimeout("count()",1000);
}
//-->
</script>
<form name="go">
<input type="text" name="timer" size="12">
<input type="button" value="Start" onClick="count()">
<input type="text" name="txtMsg" value="" size="26">
<input type="button"
name="resetButton"
value="Reset"
onClick = document.go.timer.value='';document.go.txtMsg.value=''
>
</form>
</body>
onClick = document.form.name.value=""
(from JSKit) but somehow it doesn't work in the code below -- values keep re-appearing in two text boxes. Is there something about the script itself as I've modified it that is the problem? The timer and counter work fine, the reset button does not. I've placed the script inside the <body> tags because I want to put the counter and reset buttons inside a page with other scripts once they're done. Thanks.
<body bgcolor="#FFFFFF">
<script language="JavaScript">
<!--
//on-screen timer
//JavaScriptKits at http://www.javascriptkit.com/
//modified by Bob Higgins
var c=0;
document.go.timer.value="";
function count()
{
document.go.timer.value=c;
c=c+1;
if (c>5){
document.go.timer.value=5;
document.go.txtMsg.value=("TIME IS UP!!!");
document.close();
}
setTimeout("count()",1000);
}
//-->
</script>
<form name="go">
<input type="text" name="timer" size="12">
<input type="button" value="Start" onClick="count()">
<input type="text" name="txtMsg" value="" size="26">
<input type="button"
name="resetButton"
value="Reset"
onClick = document.go.timer.value='';document.go.txtMsg.value=''
>
</form>
</body>