F
Floortje
Hi, im an absolute noob at javascript. I copied a timer from a site wich
counts to 5 minutes and then pos up an alert. Is it possibel to
automatically submit the form after I click ok ?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<SCRIPT LANGUAGE = "JavaScript">
<!--
var secs
var timerID = null
var timerRunning = false
var delay = 1000
function InitializeTimer()
{
// Set the length of the timer, in seconds
secs = 300
StopTheClock()
StartTheTimer()
}
function StopTheClock()
{
if(timerRunning)
clearTimeout(timerID)
timerRunning = false
}
function StartTheTimer()
{
if (secs==0)
{
StopTheClock()
// Here's where you put something useful that's
// supposed to happen after the allotted time.
// For example, you could display a message:
alert("De tijd is voorbij. Druk op ok en daarna op opslaan")
}
else
{
self.status = secs
secs = secs - 1
timerRunning = true
timerID = self.setTimeout("StartTheTimer()", delay)
}
}
//-->
</SCRIPT>
<body onLoad="InitializeTimer()" >
<h1> Header here</h1>
<p>text</p>
<form name="form1" method="post" action="">
<table width="100%" border="1">
<tr>
<td width="17%">positief</td>
<td width="83%"><div align="right">
<textarea name="positief" cols="100" rows="5"
id="positief"></textarea>
</div></td>
</tr>
</table>
</form>
</body>
</html>
counts to 5 minutes and then pos up an alert. Is it possibel to
automatically submit the form after I click ok ?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<SCRIPT LANGUAGE = "JavaScript">
<!--
var secs
var timerID = null
var timerRunning = false
var delay = 1000
function InitializeTimer()
{
// Set the length of the timer, in seconds
secs = 300
StopTheClock()
StartTheTimer()
}
function StopTheClock()
{
if(timerRunning)
clearTimeout(timerID)
timerRunning = false
}
function StartTheTimer()
{
if (secs==0)
{
StopTheClock()
// Here's where you put something useful that's
// supposed to happen after the allotted time.
// For example, you could display a message:
alert("De tijd is voorbij. Druk op ok en daarna op opslaan")
}
else
{
self.status = secs
secs = secs - 1
timerRunning = true
timerID = self.setTimeout("StartTheTimer()", delay)
}
}
//-->
</SCRIPT>
<body onLoad="InitializeTimer()" >
<h1> Header here</h1>
<p>text</p>
<form name="form1" method="post" action="">
<table width="100%" border="1">
<tr>
<td width="17%">positief</td>
<td width="83%"><div align="right">
<textarea name="positief" cols="100" rows="5"
id="positief"></textarea>
</div></td>
</tr>
</table>
</form>
</body>
</html>