<!--
//
// Function insChr is used to add special characters into a WebCT Short
// Answer question (input type text) or Paragraph question (input type
// textarea) fill-in response.
//
// Usage:
//     Put this script after the upper text block (header). Call it from
//     a table of buttons using onClick="insChr(this.form,[code])" parameter.
//
// Limitations:
//     Characters are always added after the current text.
//     The function only works with single answer box questions.
//
// Parameters:
//     whatform - Name of the form from which the function was called
//       (use "this.form" to indicate the current form).
//     aCode - Numeric value for character desired (decimal)
//
// Copywrite © 2001 by Thain Marston
// This script is Freeware for noncommercial and educational uses provided
// this copy write notice is included. The author would appreciate hearing
// about its use via email at pthainmarston@cs.com.
//     
function insChr(whatform,aCode) {
        var i = 0, eType = "", eName = "";
        var myFormName = whatform.name
        var myElements = whatform.elements;
        var noElements = myElements.length;
        for (i = 0; i < noElements; i++) {
                anElement = myElements[i];
                eType = anElement.type;
                if (eType == "text") {
                        eName = anElement.name;
                        break;
                }
			if (eType == "textarea") {
					eName = anElement.name;
					break;
			}
        }
        anElement.value += String.fromCharCode(aCode);
        anElement.focus();

}// -->

