Script says Undefined
<p>I have this script that would let the user input a text and it would get translated into something else. It works only when the word has only 1 letter. When there is more than 1 letter it says Undefined.</p>

<p>Here is the script : </p>

<pre><code>function copyit(theField) {
    var tempval = eval("document." + theField)
    tempval.focus()
    tempval.select()
    therange = tempval.createTextRange()
    therange.execCommand("Copy")
}

function results() {
    var behavior = "form";
    var text = document.csrAlpha.csrresult2.value;
    var ff22 = text.toLowerCase();
    var Words = new Array;
    Words["b"] = "Dadada";
    Words["bob"] = "Robert";
    Words["flower"] = "Banana";
    Words["brad"] = "Chair";
    var trans = "";
    var regExp = /[\!@#$%^&amp;*(),=";:\/]/;
    var stringCheck = regExp.exec(ff22);
    if (!stringCheck) {
        if (ff22.length &gt; 0) {
            for (var i = 0; i &lt; ff22.length; i++) {
                var thisChar = ff22.charAt(i);
                trans += Words[thisChar] + " ";
            }
        } else {
            trans += "Please write something.";
        }
    } else {
        trans += "You entered invalid characters. Remove them and try again.";
    }
    document.csrAlpha.csrresult.value = trans;
}
</code></pre>

<p>And the HTML:</p>

<pre><code>&lt;table&gt;
  &lt;tr&gt;
    &lt;td align="center" class="cleanuphtml-1"&gt;
      &lt;form name="csrAlpha"&gt;
        Please insert your text below:&lt;br /&gt;
        &lt;input type="text" class="tb3" name="csrresult2" size="70" maxlength="120" autocomplete="off" onkeydown="results()" onkeyup="results()" onkeypress="return handleEnter(this, event);" /&gt;
        &lt;input type="reset" value="Reset" onclick="csrAlpha.csrresult2.focus();" /&gt;

        &lt;p&gt;
          &lt;textarea name="csrresult" class="tb7" cols="71" rows="10" value=""&gt;&lt;/textarea&gt;
        &lt;/p&gt;
      &lt;/form&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
</code></pre>
