From b1ba290f249d84989cb3cc38d018482794582a46 Mon Sep 17 00:00:00 2001
From: hardythe1
Date: Thu, 22 Mar 2012 16:56:22 +0530
Subject: Autocomplete tagging functionality
---
testapp/static/exam/js/question.js | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 testapp/static/exam/js/question.js
(limited to 'testapp/static/exam/js/question.js')
diff --git a/testapp/static/exam/js/question.js b/testapp/static/exam/js/question.js
new file mode 100644
index 0000000..554a948
--- /dev/null
+++ b/testapp/static/exam/js/question.js
@@ -0,0 +1,37 @@
+ var time_left = {{ time_left }};
+ function submitCode()
+ {
+ document.forms["code"].submit();
+ var x = document.getElementById("status");
+ x.innerHTML = "Checking answer ...";
+ 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 = "" + t_str + "";
+ setTimeout("update_time()", 1000);
+ }
+ else
+ {
+ document.forms["code"].submit();
+ }
+ }
--
cgit