Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7780523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:55:32+00:00 2026-06-01T18:55:32+00:00

I Have some Formulas in Javascript and trying to format them but unable to

  • 0

I Have some Formulas in Javascript and trying to format them but unable to do that .
Here is my JS code from which i am trying to make calculations
I have these two variable from which i get input and then make calculations

var pkrusd;
var pkrusd = parseFloat(document.getElementById('txtpkrusd').value, 10); 
var ratelb;
ratelb = parseFloat(document.getElementById('txtRatelb').value, 10);

And here are my formulas from which i show results

var res;
res=roundNumber((pkrusd*ratelb)/100.00,2);
document.getElementById('txtF5').value = addCommas(res);
//Per Kg
var perkg=((pkrusd*ratelb)/100.00)*2.20462262184878;
document.getElementById('txtperkg').value=addCommas(roundNumber(perkg,2));
//RS Per Maund
var perMaund=roundNumber((((pkrusd*ratelb)/100.00)*2.20462262184878)*37.3242,2);
document.getElementById('txtperMaund').value=addCommas(perMaund);

Problem is that when i res formula and values pkrusd and ratelb are 91 and 100 and formula for these is (91*100)/100 the result is 91 but i want to set some formating that should be displayed as 91.00 and when values are (91*250)*100 then result is 227.5 but i want to display as 227.50.If there any possibilty for this then please help me to do this

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T18:55:34+00:00Added an answer on June 1, 2026 at 6:55 pm

    Have a look at toFixed()

    Example:

    var n=91;
    alert(n.toFixed(2));
    

    That outputs 91.00

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some PHP code that is designed to make a spreadsheet with formulas
I have some formulas that I have defined as functions. I've then 'named' them
I have some perl code that looks something like this: my @array = map
I have some UIViews that have different centers and transforms applied to them. I
I have an FLA done in Flash 10, and some AS3 code that manipulates
I have some ODF files with math formulas and I need to render them...or
I'm trying to convert some Excel formulas into C# code, and I'm kind of
I have an excel spreadsheet that contains some formulas to calculate ROI for an
I have some formulas in my reports, and to prevent divsion by zero I
I have some input elements that the users are request special behavior on pageup

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.