JSFiddle - React, Tailwind, and code Playground
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>UoP assessment</title>
<link href="/ece70141/CSS/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
</head>
<body> <!-- PRESENT FIRST QUESTION ON PAGE LOAD -->
<div id="wrapper">
<div id="header"><span class="time" id="servertime"></span></div>
<div id="top_nav">
<div id="top_menu"> </div>
</div>
<div id="navigation"></div>
<div id="bodyArea">
<h1 align="center" >predefined</h1>
<form id="testForm" method="post" action="add_responses.php">
<input type="hidden" name="user_id" value="3"/>
<input type="hidden" name="test_id" value="27"/>
<input type="hidden" name="timestart" value="1305402245"/>
<div id=div0 class=question><p><h2>Question 1. </h2>
<h3>Clicking on an icon with the mouse is a form of giving an instruction to the computer.</h3></p>
<input name='response[0][id]' type='hidden' value='9'><strong>1.</strong>
<input type='radio' name='response[0][answer]' value='FALSE'> FALSE</br><strong>2.</strong>
<input type='radio' name='response[0][answer]' value='TRUE'> TRUE</br></div>
<div class="submit">
<input name="submit" type="submit"...
JavaScript
// TEST COUNTDOWN CLOCK
function countdown(timestamp) {
//Recursive call, keeps the clock ticking.
var timeoutID = setTimeout(function() {
countdown(timestamp);
}, 1000);
timetarget = new Date(timestamp);
var Today = new Date();
var Todays_Date = Today.getTime();
var Target_Date = timetarget.getTime();
var tester = new Date(Target_Date);
//Find their difference, and convert that into seconds.
var Time_Left = Math.round((Target_Date - Todays_Date) / 1000);
if (Time_Left < 0) {
Time_Left = 0;
}
if (Todays_Date >= Target_Date) {
clearTimeout(timeoutID);
$('#testForm').submit();
alert("Timeup, Submitting exam....");
return;
}
//More datailed.
days = Math.floor(Time_Left / (60 * 60 * 24));
Time_Left %= (60 * 60 * 24);
hours = Math.floor(Time_Left / (60 * 60));
Time_Left %= (60 * 60);
minutes = Math.floor(Time_Left / 60);
Time_Left %= 60;
seconds = Time_Left;
if (hours == 0 && minutes < 10) {
document.getElementById('countdown').style.color = 'red';
}
if (seconds < 10) {
seconds = '0' + seconds;
}
if (minutes < 10) {
minutes = '0' + minutes;
}
html = hours + ':' + minutes + ':' + seconds + ' secs';
document.getElementById('countdown').innerHTML = html;
}
var where;
var questions = "<?= $no_of_q ?>";
questions = questions - 1;
function Toggle(ID) { // FUNCTION TO TOGGLE QUESTION DIVS
if (ID == questions) {
$('#next').hide();
}
else {
$('#next').show();
}
if (ID == 0) {
$('#prev').hide();
}
else {
$('#prev').show();
}
$('.question').hide(); // hide all questions by class
where = ID; // which question is currently shown
$('#div' + ID).show(); // show div sleected by ID.
}
function move(w, m) { // MOVE TO NEXT QUESTION OR PREVIOUS.
if (w == "next") {
where++;
...