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/edit_question.js | 172 ++++++++++++++++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 testapp/static/exam/js/edit_question.js (limited to 'testapp/static/exam/js/edit_question.js') diff --git a/testapp/static/exam/js/edit_question.js b/testapp/static/exam/js/edit_question.js new file mode 100644 index 0000000..69e0d97 --- /dev/null +++ b/testapp/static/exam/js/edit_question.js @@ -0,0 +1,172 @@ +function render_question(frm) +{ + for(var i=1;i<=frm.description.length;i++) + { + document.getElementById('my'+i).innerHTML = frm.description[i-1].value; + } + +} + +function increase(frm,n) +{ + var newValue = document.getElementById('id_points'+ (n-1)).value ; + + if( newValue == "") + { + document.getElementById('id_points'+(n-1)).value = "0.5"; + return; + } + document.getElementById('id_points' + (n-1)).value = parseFloat(newValue) + 0.5; +} + +function decrease(frm,n) +{ + var newValue = document.getElementById('id_points'+ (n-1)).value ; + + if( newValue > 0) + { + document.getElementById('id_points' + (n-1)).value = parseFloat(newValue) - 0.5; + } + else + { + document.getElementById('id_points' + (n-1)).value = 0; + } +} + + +function data(showContent,showHideDiv,a,summary) +{ + var con = document.getElementById(showContent); + var ele=document.getElementById(showHideDiv); + var atag=document.getElementById(a); + if (ele.style.display=="block") + { + con.style.display = "none" + ele.style.display = "none"; + atag.text = summary; + } + else + { + con.style.display = "block"; + ele.style.display = "block"; + } +} + +function textareaformat() +{ + var point = document.getElementsByName('points'); + var test = document.getElementsByName('test'); + var option = document.getElementsByName('options'); + var descriptions = document.getElementsByName('description'); + var type = document.getElementsByName('type'); + var tags = document.getElementsByName('tags'); + + for (var i=0;i 0) + { + alert('Enter 4 options. One option per line.'); + return false; + } + return true; +} -- cgit From c8b68813ca80aee16261e5f02d541ed48712feae Mon Sep 17 00:00:00 2001 From: Hardik Ghaghada Date: Fri, 26 Apr 2013 16:40:34 +0530 Subject: Dumped JS from HTML pages to separate JS files --- testapp/static/exam/js/edit_question.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'testapp/static/exam/js/edit_question.js') diff --git a/testapp/static/exam/js/edit_question.js b/testapp/static/exam/js/edit_question.js index 69e0d97..acba384 100644 --- a/testapp/static/exam/js/edit_question.js +++ b/testapp/static/exam/js/edit_question.js @@ -33,6 +33,19 @@ function decrease(frm,n) } } +function grade_data(showHideDiv) +{ + var ele=document.getElementById(showHideDiv); + if (ele.style.display=="block") + { + ele.style.display = "none"; + } + else + { + ele.style.display = "block"; + } +} + function data(showContent,showHideDiv,a,summary) { -- cgit