title: Javascript 'undefined error' in asp.net webform
body: <p>I'm not a javascript expert, but I've used it before, and this problem is perplexing me.  Here's the javascript:  </p>
  
  <pre><code>function formatNumThousands(myNumber) {
      if (myNumber.length &gt; 0) {
          var index = myNumber.indexOf(',');
          while (index != -1) {
               myNumber = myNumber.replace(',', '');
               index = myNumber.indexOf(',');
          }
          var myResult = '';
          for (var i = myNumber.length - 1; i &gt;= 0; i--) {
              myResult = myNumber[i] + myResult;
              if ((myNumber.length - i) % 3 == 0 &amp; i &gt; 0) myResult = ',' + myResult;
          }
          document.getElementById('&lt;%=txtMyNumber.ClientID%&gt;').value = myResult;
       }
    }
  </code></pre>
  
  <p>In the code behind, I set the attribute for this text box's OnBlur event:  </p>
  
  <pre><code>this.txtMyNumber.Attributes.Add("onblur", "formatNumThousands(this.value);");
  </code></pre>
  
  <p>I build and publish the app and it runs fine on my machine.  Two other users get 'undefined' in the text box, regardless of what they do.</p>