diff options
author | hardythe1 | 2012-03-28 11:55:34 +0530 |
---|---|---|
committer | hardythe1 | 2012-03-28 11:55:34 +0530 |
commit | 64b38d3365f1d65132942fce6e29fed7da076bba (patch) | |
tree | 15c07993620743f097cbf739e90fc3da59b957b1 /testapp/templates/exam/question.html | |
parent | 246478f4ef75ae713e96a64d210bd3710bed3df9 (diff) | |
download | online_test-64b38d3365f1d65132942fce6e29fed7da076bba.tar.gz online_test-64b38d3365f1d65132942fce6e29fed7da076bba.tar.bz2 online_test-64b38d3365f1d65132942fce6e29fed7da076bba.zip |
minor changes
Diffstat (limited to 'testapp/templates/exam/question.html')
-rw-r--r-- | testapp/templates/exam/question.html | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/testapp/templates/exam/question.html b/testapp/templates/exam/question.html index 981af7f..87ed40d 100644 --- a/testapp/templates/exam/question.html +++ b/testapp/templates/exam/question.html @@ -9,7 +9,45 @@ {% endblock %} {% block script %} -<script src="{{ URL_ROOT }}/static/exam/js/question.js"></script> +<script> + var time_left = {{ time_left }}; + function submitCode() + { + document.forms["code"].submit(); + var x = document.getElementById("status"); + x.innerHTML = "<strong>Checking answer ...</strong>"; + x = document.getElementById("check"); + x.disabled = true; + x.value = "Checking Answer ..."; + document.getElementById("skip").disabled = true; + } + + function secs_to_time(secs) + { + var h = Math.floor(secs/3600); + var h_s = (h > 0) ? h+'h:' : ''; + var m = Math.floor((secs%3600)/60); + var m_s = (m > 0) ? m+'m:' : ''; + var s_s = Math.floor(secs%60) + 's'; + return h_s + m_s + s_s; + } + + function update_time() + { + time_left -= 1; + if (time_left) + { + var elem = document.getElementById("time_left"); + var t_str = secs_to_time(time_left); + elem.innerHTML = "<strong>" + t_str + "</strong>"; + setTimeout("update_time()", 1000); + } + else + { + document.forms["code"].submit(); + } + } +</script> {% endblock script %} {% block onload %} onload="update_time()" {% endblock onload %} |