Calculator HTML form using Javascript -


i have little issue. that's code , don't know have made wrong. try complete simple html form calculate given number in text input html element.

function rebate(){    var rebate_a,rebate_b,total,final;      var = document.myform.rebatenum.value;      if( <= 3000 )    {      final = a;    }    else if ( (a > 3000) && (a <= 10000 ) )    {       rebate_a = (a-3000) * 0.02;      total = rebate_a;      final = - rebate_a;    }    else if ( (a > 10000) && (a <= 30000 ) )    {       rebate_a = (7000 * 0.02) + (a-10000) * 0.03;      total = rebate_a;      final = - rebate_a;    }    else if ( (a > 30000) && (a <= 40000 ) )    {       rebate_a = (7000 * 0.02) + (20000 * 0.03) + (a-30000) * 0.05;      total = rebate_a;      final = - rebate_a;    }    else if( (a >= 40000) && (a < 50000 ))    {      rebate_a = (7000 * 0.02) + (20000 * 0.03) + (10000 * 0.05) + (a-40000) * 0.06;      rebate_b = 25;      total = rebate_a + rebate_b;      final = - total;    }    else    {      document.myform.final.value = "20";    }      document.getelementbyid("demo").innerhtml = a;    document.myform.final.value = final;  }
<form name="myform">  <table border="0">  <tr>  <td>initial price</td>      <td><input name="rebatenum" type="text" size="12" onchange="rebate();"></td>  </tr>  <tr>      <td colspan="2"><input type="button" value="Υπολογισμός" onclick="rebate();"></td>  </tr>  <tr>          <td colspan="2"></td>  </tr>  <tr>       <td>final price after rebate:</td>       <td><input type="text" name="final" size="12"></td>  </tr>  </table>  </form>      <p id="demo"></p>

you can find here!!!

http://jsfiddle.net/pf7lysqt/3/


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -