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

  • SEARCH
  • Home
  • 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 7907189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:18:48+00:00 2026-06-03T11:18:48+00:00

I have this calculating form works extremely well for my client up some one

  • 0

I have this calculating form works extremely well for my client up some one went and put in to the percentage box 0.93 and it showed to wrong amount.

In the website: 10 x 10 x 15 x 0.93 = 13.95

Has to be: 10 x 10 x 15 x 0.93 = 1.395

I have no idea what to change in the javascript to get the full stop in the right place

This is the script.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<script type="text/javascript">
function calculate() {
    var fields = [], i = 1, el, val, whole, total;
    for (i; i < 5; ++i) {
        el = document.getElementById('el' + i); val = el.value;
        if((whole = i < 3) && /\./.test(val) || isNaN(Number(val))) {
            alert("Please enter only " + (whole? 'whole ' : '') +    "numbers\nfor " + (el.value = el.defaultValue));
            el.focus();
            el.select();
            return;
        }
        fields.push(val);
    }
    total = (fields[0] * fields[1] * fields[2])*fields[3]/100;
    document.getElementById('calculate').innerHTML = "Total: " + total;
}
</script></head>

<body>
<form action="#" onSubmit="calculate(); return false;">
    <label>Days: <input type="text" id="el1" value="10"></label>
    <label>Taxis: <input type="text" id="el2"  value="10"></label>
    <label>Perdiem: <input type="text" id="el3" value="15"></label>
    <label>Discount: <input type="text" id="el4" value="93"></label>
    <div id="calculate">Total:</div>
    <br />
    <br />
    <input type="submit" value="Calculate">
</form>
</body>

</html>

I will appreciate any help with this.

Thanks

  • 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-03T11:18:49+00:00Added an answer on June 3, 2026 at 11:18 am

    Have you tried using:

    total = (fields[0] * fields[1] * fields[2])*fields[3]/1000

    instead of:

    total = (fields[0] * fields[1] * fields[2])*fields[3]/100

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

Sidebar

Related Questions

I have a loop like this: for i=1:no %some calculations fid = fopen('c:\\out.txt','wt'); %write
I have a simple HTML Form that allows the user to enter some text
I have a mystery.html page that loads some javascript (as well as mootools). I
I am trying to do some live calculation on my form, please have a
I have a windows form 'MyForm' with a text box that is bound to
I have this function that takes the input of a, runs a calculation and
I have a method, which uses random samples to approximate a calculation. This method
Have this query: SELECT HOUR( DATE ) AS hr, COUNT( * ) AS cnt
Have this self-made slider: http://jsfiddle.net/wyc3P/4/ What it does: takes min and max values in
I have this array in PHP: array( [0] => array( 'username' => 'user1' )

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.