How to set the time limit in online exam
I am doing online examination project, in that my requ开发者_JS百科irement is to set one questions in one page,the maximum time limit for the question is 60 seconds, count down. how to set the time limit in jsp .can any one help me.
This can easily done using javascript.
I hope you are not trying to avoid javascript.
You can find how to do it here.
In case you are looking for something else maybe you would like to check this out
I don't know much about JSP but you can try this Javascript...
<html>
<head>
<script language="javascript">
var Timer;
var TotalSeconds;
function CreateTimer(TimerID, Time)
{
Timer = document.getElementById(TimerID);
TotalSeconds = Time;
UpdateTimer()
window.setTimeout("Tick()", 1000);
}
function Tick()
{
TotalSeconds -= 1;
if(TotalSeconds ==-1)
{
alert("Time Up");
// Show alert Plus redirect any other page
}
else
{
UpdateTimer()
window.setTimeout("Tick()", 1000);
}
}
function UpdateTimer() {
Timer.innerHTML = TotalSeconds;
}
</script>
</head>
<body>
<div id='timer' />
<script type="text/javascript">window.onload = CreateTimer("timer", 60);</script>
</body>
</html>
Save this as an HTML page and check if this is what you need...
Hope this helps
You can set it by using javascript.
You will find timer and its related stuff on the internet.
You have to just set the time and provide the URL. Then it will forward the page accordingly.
I hope this help you to understand the solution.
While I agree, that the time limit countdown must be done via JavaScript, there also must be a server-side time check, because JavaScript can be easily disabled. Create a time mark when student gets the question and compare it to a time mark when he posts an answer.
Hint: You may use System.currentTimeMillis()
function to get current server time in milliseconds (1 sec = 1000 ms).
+1 for @Bravo.
But I prefer you buy available online scripts in market as starting point for it.
This will save you time, cost and testing efforts.
Below is one of the fine scripts that I worked it and it worked like charm. Using this as base I developed a online testing portal of over 1000 users using computer adaptive test.
http://codecanyon.net/item/online-skills-assessment/9379895
It is a good starting point for people looking to develop Online Exam System
精彩评论