templates/display_question.html
author nishanth
Fri, 02 Jul 2010 14:12:25 +0530
changeset 87 e81b105b1128
parent 55 8d78e1e62424
permissions -rw-r--r--
found easier way to get things done. so removed all the junk code.

{% extends 'base.html' %}
{% block script %}
<script language="javascript">
		var time_left = {{question.time_limit}};
		function dec_counter (){
				time_left -= 1;
				if (time_left) {
						document.getElementById("time_left").innerHTML = "Time left: " + time_left + " secs";
						setTimeout("dec_counter()", 1000);
				}
				else {
						dopost();
				}
		}
        function dopost (){
            document.getElementById("queform").submit();
        }
//		setTimeout("dec_counter()", 1000);
    </script>
{% endblock %}
{% block onload %} onload="dec_counter()" {% endblock %}
{% block content %}
{{question.description|linebreaksbr}}	<br />
{% if question.code %}
<br />
<fieldset><pre>{{question.code}}</pre></fieldset>
{% endif %}
<br />
Answer:<br />
<form action="" method="post" id="queform">
		{% if options %}
		{% for option in options %}	
		<input name="answer" type="radio" value="{{option}}" > {{option}} <br />
		{% endfor %}
		<br />
</select>
{% else %}
<textarea name="answer" rows="10" cols="40"></textarea><br />
{% endif %}
<input type="submit" value="Submit">
</form>
<h2 id="time_left"> Time left: {{question.time_limit}} secs</h2>
{% endblock %}