| | |
Generating clientside javascript
Please support our ASP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2007
Posts: 22
Reputation:
Solved Threads: 0
I'm currently working on my online quiz application. It is based on ASP.
I want to add the countdown timer in every quiz that run.
But the problem is the javascript will go freeze in my ASP, it only run each time i refreshed the page.
Some suggest me to use the clientside javascript to get the time running.
Anybody can help me with this?
Your help is very much to me. Thanks.
I want to add the countdown timer in every quiz that run.
But the problem is the javascript will go freeze in my ASP, it only run each time i refreshed the page.
Some suggest me to use the clientside javascript to get the time running.
Anybody can help me with this?
Your help is very much to me. Thanks.
•
•
Join Date: Mar 2007
Posts: 22
Reputation:
Solved Threads: 0
Okay now i can see it.
Well how can set up the limitation time.
I wrote the code :
If document.theTimer.theTime.value = "01:00" {
Stop();
}
But the clock dont even run.
Im new in Java, so any help will be great. Thanks.
Well how can set up the limitation time.
I wrote the code :
If document.theTimer.theTime.value = "01:00" {
Stop();
}
But the clock dont even run.
Im new in Java, so any help will be great. Thanks.
•
•
Join Date: Mar 2007
Posts: 22
Reputation:
Solved Threads: 0
•
•
•
•
Make sure you have these options in the html body tag
<body onload="Reset()" onunload="Stop()">
Regards
D
I think i miss-place the limitation code.
The limitation code is :
If document.theTimer.theTime.value = "01:00" {
Stop();
}
Where should i place the code?
<script language="JavaScript">
<!--
// please keep these lines on when you copy the source
// made by: Nicolas - http://www.javascript-page.com
var timerID = 0;
var tStart = null;
function UpdateTimer() {
if(timerID) {
clearTimeout(timerID);
clockID = 0;
}
if(!tStart)
tStart = new Date();
var tDate = new Date();
var tDiff = tDate.getTime() - tStart.getTime();
tDate.setTime(tDiff);
document.theTimer.theTime.value = ""
+ tDate.getMinutes() + ":"
+ tDate.getSeconds();
timerID = setTimeout("UpdateTimer()", 1000);
If document.theTimer.theTime.value = "01:00" {
Stop();
}
}
function Start() {
tStart = new Date();
document.theTimer.theTime.value = "00:00";
timerID = setTimeout("UpdateTimer()", 1000);
}
function Stop() {
if(timerID) {
clearTimeout(timerID);
timerID = 0;
}
tStart = null;
}
function Reset() {
tStart = null;
document.theTimer.theTime.value = "00:00";
}
//-->
</script>
<body onload="Reset()" onunload="Stop()">
<center><form name="theTimer"><table>
<tr>
<td colspan=3 align=center>
<input type=text name="theTime" size=5>
</td>
</tr>
<tr><td></td></tr>
<tr>
<td>
<input type=button name="start" value="Start" onclick="Start()">
</td>
<td>
<input type=button name="stop" value="Stop" onclick="Stop()">
</td>
<td>
<input type=button name="reset" value="Reset" onclick="Reset()">
</td>
</tr>
</table></form></center>
Oh ya, im working on the resume function so the time will not be reset when the page is being refreshed.
Any helps of this will once again a big thank you from me.
![]() |
Similar Threads
- onmouseover for asp.net2.0 controls (ASP.NET)
- Javascript - Print Date in different color (JavaScript / DHTML / AJAX)
- How can we include a clientside script like Java script (ASP.NET)
- how to pass a array from asp to javascript (JavaScript / DHTML / AJAX)
Other Threads in the ASP Forum
- Previous Thread: Type mismatch
- Next Thread: ASP.net Hosting Urgent
| Thread Tools | Search this Thread |
archive asp asp.net aspandmssqlserver2005 aspandmssqlserver2005connection aspconnection connection database databaseconnection dreamweaver excel fso iis msmsql mssql2005 mssqlserver2005 mssqlserver2005andasp mssqlserverandasp opentextfile record searchbox selectoption single specfic sqlserver sqlserverconnection windows7





