php - javascript onblur onMouseOver calculate tax and autofill form input -


after 2 days searching give up. have form , need add (autofill) taxes input total price in easy simple way:

<form name="form" action="go.php">  <input name="cost" type="text">  <input name="costplustax" type="text" value=" here autofill cost +19%>  <input type="submit" value="ready mysql"> 

i can nothing javascript tested lot of examples complicated. need autofill input costplustax cost plus tax

example

cost 100.000 because tax 19% autofilll input onblur or onmouseover 119.000

how this?

first add id elements (this makes referencing elements js easier). ex

<input name="cost" type="text"> 

becomes

<input name="cost" id="cost" type="text"> 

you need add script tag house js code this

<script>   var taxperc = .19;    document.getelementbyid("cost").onblur = function(){     document.getelementbyid("costplustax").value = parsefloat(document.getelementbyid("cost").value) * (1.00 + taxperc)   } </script> 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -