Widget:Quiz Numeric Cloze

Infrastructure for building an eXe-like fill-in-the-blank numeric quiz  function check(q, n) { var all = true; var caution = ''.toLowerCase; $('#'+q).find('.' + n).each(function {     if ($(this).val == '') {        all = false;      }    }  ); if (all) { $('#' + q).find('.' + n).each(function {       if ((caution == 'true') && ($.trim($(this).val).length < $(this).attr("qword").length)) {           $(this).css('background', '#FFCC00');         } else {          var guess= parseFloat($(this).val);          var answer = parseFloat($(this).attr("qword"));          if (guess-answer==0) {            $(this).css('background', 'LightGreen');            $(this).attr('disabled', true).unbind('blur');           } else {            $(this).css('background', 'LightPink');          }        }       }    ) } }

$(function { $('head').append(' ' + 'div.weQuiz { border-style: solid; border-width: 1px;' + 'border-color: #AAAAAA; padding: 1ex; background-color: #F6F9ED; }' + 'ul.weQquestion { list-style-type: decimal; list-style-image: none; margin-left: 75px;}' + 'ul.weQoption { list-style-type: none; list-style-image: none;}' + 'ul.weQresponse { list-style-type: none; list-style-image: none; display: none; }' + 'img.weQuiz { float: left; }' + 'h1.weQuiz {font-size: 130%; font-weight: bold; border: none; }' + ' '); var qn = 'q' + '';  var $q = $('#' + qn);  $q.children('ul').addClass('weQquestion').wrap('  ');  var $us = $q.find('u').each( function(i) { var s = $(this).text.replace(/^\s*/, ).replace(/\s*$/, ).split(/\s+/);; var r = ''; var id = qn + '_' + i;     for (var j=0; j '; }     $(this).replaceWith(r); } ); });