title: JavaScript function will only work once
body: <p>I have a JavaScript function that is triggered onchange. What it does is take the value from a input field and then add it to the value entered in another field and then display the answer in a different field.</p>
  
  <p>It works fine the first time, but when I enter a new value and leave the field there is an error: <code>TotalPurchasePrice is not a function</code></p>
  
  <pre><code>function TotalPurchasePrice(BuyinPrice, TopupAmount) {
  var BuyinPrice
  var TopupAmount
  BuyinPrice = BuyinPrice.toString().replace(/\£|\,/g, '');
  TopupAmount = TopupAmount.toString().replace(/\£|\,/g, '');
  
  TotalPurchasePrice = (BuyinPrice * 1) + (TopupAmount * 1);
  
  document.getElementById('tTotalPurchasePrice').value = TotalPurchasePrice;
  }
  </code></pre>
  
  <p>Can anyone tell me why this would only work once?</p>