Click here to Skip to main content
14,330,776 members
Rate this:
Please Sign up or sign in to vote.
See more:
when submit the quiz test before the time completion then time should be expire.I don't know how to display and my code is given below-

What I have tried:

Start


Stop 
 <br>
<div class="chapt_body" id="quiz">
<div id="results">
<div align="center" id="score">
</div>

</div>
<div>
<span class="vs_normaltext">01.	( 25 × 21 × 12) ÷ ? = 15</span> 
 
<div id="LANS.1.0">
(A) 420</div>
<div id="LANS.1.1">
(B)500</div>
<div id="LANS.1.2">
(C) 450</div>
<div id="LANS.1.3">
(D) 300</div>
<div id="LANS.1.4">
(E) none of these</div>

</div>
<br> 


 
<div>
<span class="vs_normaltext">02.	20% of ? = 12% of 625</span> 
 
<div id="LANS.2.0">
(A) 375</div>
<div id="LANS.2.1">
(B)300</div>
<div id="LANS.2.2">
(C) 250</div>
<div id="LANS.2.3">
(D) 273</div>
<div id="LANS.2.4">
(E) None of these</div>
</div>
<br> 


 
<div>
<span class="vs_normaltext">03.	3.2% of 500 × 2. 4% of ? = 288</span> 
 
<div id="LANS.3.0">
(A)750 </div>
<div id="LANS.3.1">
(B)600</div>
<div id="LANS.3.2">
(C)650</div>
<div id="LANS.3.3">
(D)700</div>
<div id="LANS.3.4">
(E)None of these</div>
</div>
<br> 



<div id="btn_submit">
<div align="center">

</div>
</div>
<div id="btn_reset">
<div align="center">

</div></div></div>
Posted
Updated 5-Oct-19 10:20am
v2
Comments
MadMyche 5-Oct-19 16:50pm
   
Where is the timer?
arpita prajapati 6-Oct-19 3:55am
   
var tim;

var min = 1;
var sec = 60;
var f = new Date();
function f1() {
f2();
document.getElementById("starttime").innerHTML = "Your started your Exam at " + f.getHours() + ":" + f.getMinutes();

document.getElementById("endtime").innerHTML = "Your time is :" + f.toLocaleTimeString();
}
function f2() {
if (parseInt(sec) > 0) {
sec = parseInt(sec) - 1;
document.getElementById("showtime").innerHTML = "Your Left Time is :" + min + " Minutes ," + sec + " Seconds";
tim = setTimeout("f2()", 1000);
}
else {
if (parseInt(sec) == 0) {
min = parseInt(min) - 1;
if (parseInt(min) == 0) {
clearTimeout(tim);
location.href = "restt.aspx";
}
else {
sec = 60;
document.getElementById("showtime").innerHTML = "Your Left Time is :" + min + " Minutes ," + sec + " Seconds";
tim = setTimeout("f2()", 1000);
}
}

}
}















01. ( 25 × 21 × 12) ÷ ? = 15


(A) 420

(B)500

(C) 450

(D) 300

(E) none of these







02. 20% of ? = 12% of 625


(A) 375

(B)300

(C) 250

(D) 273

(E) None of these






03. 3.2% of 500 × 2. 4% of ? = 288


(A)750

(B)600

(C)650

(D)700

(E)None of these





04. 3.2% of 600 × 2. 4% of ? = 288


(A)750

(B)800

(C)650

(D)700

(E)None of these




05. 3.2% of 600 × 2. 4% of ? = 288


(A)750

(B)800

(C)650

(D)700

(E)None of these
OriginalGriff 6-Oct-19 3:20am
   
That's not code: That's just HTML which is static display data.
To have anything changing or reacting to anything the user is doing, you need to have Javascript (running on the client), server based code (php, C#, VB, ...), or a combination of the two.

Your question shows none of that, and so we can't help you at all.

Use the "Improve question" widget to edit your question and provide better information.
arpita prajapati 6-Oct-19 4:06am
   
ok .
Iunderstand and my quiz timer script is given below-

var tim;

var min = 1;
var sec = 60;
var f = new Date();
function f1() {
f2();
document.getElementById("starttime").innerHTML = "Your started your Exam at " + f.getHours() + ":" + f.getMinutes();

document.getElementById("endtime").innerHTML = "Your time is :" + f.toLocaleTimeString();
}
function f2() {
if (parseInt(sec) > 0) {
sec = parseInt(sec) - 1;
document.getElementById("showtime").innerHTML = "Your Left Time is :" + min + " Minutes ," + sec + " Seconds";
tim = setTimeout("f2()", 1000);
}
else {
if (parseInt(sec) == 0) {
min = parseInt(min) - 1;
if (parseInt(min) == 0) {
clearTimeout(tim);
location.href = "#";
}
else {
sec = 60;
document.getElementById("showtime").innerHTML = "Your Left Time is :" + min + " Minutes ," + sec + " Seconds";
tim = setTimeout("f2()", 1000);
}
}

}
}



This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100