title: JavaScript not working in FF and IE
body: <p>This is difficult to track down for me as a JS newbie.</p>
  
  <p>I am writing a simple (?) Script that shows me under a textarea (which is meant for writing SMS messages) how many characters the current SMS has left and how many SMS I have written so far.</p>
  
  <p>I have the following JavaScript in my header:</p>
  
  <pre><code>&lt;script type='text/javascript'&gt;
      function CheckCount(text, length) {
          var MaxLength = new Number(length);
          messages = Math.ceil(((text.value) ? text.value.length : 0) / 160);
          remaining = messages * 160 - (((text.value) ? text.value.length : 0) % (messages * 160) || messages * 160);
          if (text.value.length == 0) { messages = 1; remaining = 160; }
          document.getElementById('messages').innerText = messages + ' SMS';
          document.getElementById('remaining').innerText = remaining + ' Characters remaining';
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>In the body of the website I put this:</p>
  
  <pre><code>&lt;textarea name="sms_text" cols="35" rows="5" onKeyUp="javascript:CheckCount(this,4000);" onChange="javascript:CheckCount(this,4000);"&gt;&lt;/textarea&gt;
  &lt;p style="margin-left:174px"&gt;
      &lt;span id="remaining"&gt;160 Characters remaining&lt;/span&gt; |
      &lt;span style="clear:both" id="messages"&gt;1 SMS&lt;/span&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>This works fine in Opera, Safari and Chrome. Firefox and IE have their issues.</p>
  
  <p>Please don't beat me too much. I am just starting with JavaScript and after a day of tedious searching I cannot get to the solution. :)</p>