title: 0x800a138a - JavaScript runtime error: Function expected
body: <p>I have a TextBox in my ASP.NET page. A javascript function is triggered when the value inside the textbox is changed. </p>
  
  <p>Any idea why I get this error?</p>
  
  <p>Error:</p>
  
  <blockquote>
    <p>0x800a138a - JavaScript runtime error: Function expected
    <img src="https://i.stack.imgur.com/dT61W.png" alt="enter image description here"></p>
  </blockquote>
  
  <p>ASP.NET code:</p>
  
  <pre><code>&lt;asp:TextBox ID="entryRates" Width="80" onChange="return showAlert(this);" runat="server" CssClass="TextBox" /&gt;
  </code></pre>
  
  <p>JS code:</p>
  
  <pre><code>&lt;script type ="text/javascript" &gt;
     function showAlert(obj) 
     {
        if (document.getElementById("rType").value!="HLDR") 
        {
          iput = obj;
          //numberic value (positive or negative)
          if (isNaN(iput.value))
          {
              alert("The entered rate is not a number");
              return false;
          }
          //today's rate
          tdrate=iput.value 
          //yesterday rate
          if (document.all.item("rType").value!="OTHR") 
          {
              ydrate = iput.parentElement.parentElement.childNodes(2).firstChild.innerText; 
          }
          else
          {
              ydrate = iput.parentElement.parentElement.childNodes(4).firstChild.innerText; 
          }
          //alert ("yesterdaycode = "+ydrate);
          trptg = 1.25  //thresholdPercent
          //alert("thresholdPercent = "+trptg);
  
        if (tdrate.length == 0)
           {
           tdrate=0
           }
  
        if (ydrate.length == 0)
           {
           ydrate=0
           }
        totchg = (((tdrate / ydrate) - 1) * 100)
  
        if (totchg &lt; 0)
           {
           totchg = (totchg * -1)
           signchg=1
           }
        else
           {
           totchg = totchg
           signchg=0
           }
  
        if (totchg != 100 &amp; totchg &gt; trptg)
           {
           if (signchg==0)
              {var s = "" + Math.round(totchg * 100) / 100}
           else
              {var s = "-" + Math.round(totchg * 100) / 100}
           alert("% Change = "+s)
           }
          }
        }  
        &lt;/script&gt;
  </code></pre>