From b2a95b4f99debc4d165bb0122b03b8e67f26b669 Mon Sep 17 00:00:00 2001 From: prathamesh Date: Wed, 12 Feb 2014 13:01:30 +0530 Subject: Modified snippet Snippet textarea extends according to the length of the snippet with numbering. The textarea to write code is dynamic with numbering. The textarea extends as per the length of the code. --- testapp/templates/exam/question.html | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'testapp/templates/exam') diff --git a/testapp/templates/exam/question.html b/testapp/templates/exam/question.html index 529b620..c8454ff 100644 --- a/testapp/templates/exam/question.html +++ b/testapp/templates/exam/question.html @@ -39,12 +39,22 @@ function update_time() document.forms["code"].submit(); } } + +function setSnippetHeight() +{ + var ta = document.getElementById('snippet'); + var height = ta.scrollHeight+'px'; + ta.style.height = 'auto'; + ta.style.height = height; + autoresize(); +} + {% endblock script %} -{% block onload %} onload="update_time()" {% endblock %} +{% block onload %} onload="update_time();setSnippetHeight()" {% endblock %} {% block pagetitle %} @@ -98,15 +108,15 @@ function update_time() {% endfor %} {% else %} - + - +
- + {% endif %} {% if question.type == "mcq" %} -- cgit