Jump to content

Javascript Calculate Not Adding Past The Decimal

Recommended Posts

Please help...i'm using the below script in a details page to calculate "Show Gross" and the formula is not calculating any numbers past the decimals.  I've tried changing the "total" to "total.toFixed(2)" in a variety of ways and it didn't help...also tried adding in ".toPrecision()" and it didn't work.  I can get the end cell to have 2 spaces with ".toFixed(2)", however the calculation does not calculate anything past the decimal.  Didn't realize this was an issue till just now & I am in a bind...please help:)  It feels like I need to tell the formula to calculate the numbers past the decimals, however I'm not sure on how to do that.


 function calculate()
 var Settle_ADV_Gross = isNaN((parseInt(document.getElementById("EditRecordSettle_ADV_Gross").value)))?0:(parseInt(document.getElementById("EditRecordSettle_ADV_Gross").value));
   var Settle_DOS_Gross = isNaN((parseInt(document.getElementById("EditRecordSettle_DOS_Gross").value)))?0:(parseInt(document.getElementById("EditRecordSettle_DOS_Gross").value));
 var Settle_Walk_Up_Gross = isNaN((parseInt(document.getElementById("EditRecordSettle_Walk_Up_Gross").value)))?0:(parseInt(document.getElementById("EditRecordSettle_Walk_Up_Gross").value));
   var total= Settle_Walk_Up_Gross + Settle_DOS_Gross + Settle_ADV_Gross;
document.getElementById("mypage").innerHTML=' $'+total ;
document.getElementById("EditRecordSettle_Show_Gross").value=total ;
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...