i want the value to be multiplied by 2.50 and add 1.95 (value*2.50)+1.95. is there any way to do this by javascript?
<form action="" id="formcalculate" method="post" name="formcalculate" >
<p class="DistanceLable">Distance in miles:</p>
<p style="position: relative; text-align: center; font-size: 11px">
<input id="ratecalculator" style="text-align: right; width: 50px; font-weight: bold; font-size: 15px" type="text" value="0"/>
</p>
<p style="text-align: center; padding-top: 3px">
<input id="btnTotal" class="art-button" type="button" value="Calculate"/>
</p>
<p id="totalcalculator" class="totalcalculator" > </p>
</form>
Modify the following two lines:
<p class="DistanceLable">Distance in miles: <span id="result"></span></p>
<input id="btnTotal" class="art-button" type="button" value="Calculate" onclick="document.getElementById('result').innerHTML = (2.50*parseFloat(document.getElementById('ratecalculator').value)+1.95).toFixed(2); " />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.