Note that there are some explanatory texts on larger screens.

plurals
  1. POlimit digits in var multiplication total
    primarykey
    data
    text
    <p>I have this:</p> <p>var ivu = (total3); document.getElementById("project_pay_total_field4").value = "$" + <strong>total3 * 0.07</strong> ;</p> <p>The multiplication produces this: </p> <p>$10.080000000000002</p> <p>--Its too long and when done in regular calculator it only says 10.08; how can i fix that? </p> <p>Here is the function: </p> <pre><code>&lt;script type = "text/javascript"&gt; function project_pay_detail() { var rate = document.getElementById("project_rate_field").value; var time = document.getElementById("project_time_field").value; var total1 = (rate * time); document.getElementById("project_pay_total_field").value = "$" + total1 + ".00"; var rate = document.getElementById("project_rate_field2").value; var time = document.getElementById("project_time_field2").value; var total2 = (rate * time); document.getElementById("project_pay_total_field2").value = "$" + total2 + ".00"; var total3 = (total1 + total2); document.getElementById("project_pay_total_field3").value = "$" + total3 + ".00" ; var ivu = (total3); document.getElementById("project_pay_total_field4").value = "$" + total3 * 0.07 ; } &lt;/script&gt; </code></pre> <p>Heres is the form</p> <p><code></p> <p> </p> <pre>&lt;div id="project_pay"&gt;Pay Rate&lt;input type="text" name="project_rate_field" id="project_rate_field" class="field" value="" /&gt;&lt;/div&gt; &lt;div id="project_pay"&gt;Total Hours&lt;input type="text" name="project_time_field" id="project_time_field" class="field" value="" /&gt;&lt;/div&gt; &lt;div id="project_pay"&gt;Project Total&lt;input type="text" name="project_pay_total_field" id="project_pay_total_field" class="field" readonly="readonly" value="" /&gt;&lt;/div&gt; &lt;input name="project_pay_details_calculate" type="button" value="Calculate1" onClick="project_pay_detail()" /&gt;&lt;/input&gt; &lt;br&gt; &lt;div id="project_pay"&gt;Pay Rate2&lt;input type="text" name="project_rate_field2" id="project_rate_field2" class="field" value="" /&gt;&lt;/div&gt; &lt;div id="project_pay"&gt;Total Hours2&lt;input type="text" name="project_time_field2" id="project_time_field2" class="field" value="" /&gt;&lt;/div&gt; &lt;div id="project_pay"&gt;Project Total2&lt;input type="text" name="project_pay_total_field2" id="project_pay_total_field2" class="field" title="0.00" readonly="readonly" value="" /&gt;&lt;/div&gt; &lt;input name="project_pay_details_refresh" type="button" value="Calculate2" onClick="project_pay_detail()" /&gt;&lt;/input&gt; &lt;div id="project_pay"&gt;Total&lt;input type="text" name="project_pay_total_field3" id="project_pay_total_field3" class="field" title="0.00" readonly="readonly" value="" /&gt;&lt;/div&gt; &lt;div id="project_pay"&gt;Ivu&lt;input type="text" name="project_pay_total_field4" id="project_pay_total_field4" class="field" title="0.00" readonly="readonly" value="" /&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload