title: Discount Calculator using HTML and javascript
body: <p>I am using this code to set a value to a html textbox the code works but the values appears and then disappear immediately. </p>
  
  <pre><code> &lt;script type="text/javascript"&gt;
      function calculate() {
         var price=0, discount=0, afterDiscount=0;
          price = Number(document.discountCalculator.price.value);
          discount = Number(document.discountCalculator.discount.value);
  
  
       afterDiscount=price - ( price*discount/100 );
  
         document.discountCalculator.price.value=price.toFixed(2);
         document.discountCalculator.discount.value=discount.toFixed(2);
         document.discountCalculator.afterDiscount.value=afterDiscount.toFixed(2);
  
      }
  </code></pre>
  
  <p></p>