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 6661765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:19:07+00:00 2026-05-26T02:19:07+00:00

This is a problem that I don’t understand because all the code validates. It’s

  • 0

This is a problem that I don’t understand because all the code validates. It’s my homework that’s due tonight at Midnight.

When I enter a value into the ‘Price’ text box and hit enter I get the $isNaN in the ‘Total’ textbox. Any suggestions. Here is the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4       /loose.dtd">
<html>
<head>
<title>Price Calculator</title>
<script type="text/javascript">
function fixOrder()
{
  var numPrice = parseFloat(document.getElementById("cost").value);
  var taxP = parseFloat(document.getElementById("tax").value);
  //var total = parseFloat(document.getElementById("total").value);

  if (isNaN(numPrice)){  
    alert("Sorry,you must enter a numeric value to place order");
    if (isNaN(taxP))
      alert("Sorry, you must enter a numeric tax value to continue");
  }

  var tax = (numPrice * taxP)/100;
  var total = numPrice + tax;
  document.getElementById("total").value = "$" + total.toFixed(2);
}
</script>

</head>

<body bgcolor="#00f3F1">

<h1 align="left">Price Calculator</h1>

<form name="form">
<p>
  Price:  <input type="text" id="cost" name="cost" value="" onchange="fixOrder();"/>
</p>
<p>
Tax: &nbsp; <input type="text" id="tax" name="tax" value="" onchange="fixOrder();"/>
</p>
<p>
  Total: <input type="text" id="total" name="total" value="" disabled="disabled();"/>
</p>
</form>

</body>
</html>
  • 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-05-26T02:19:07+00:00Added an answer on May 26, 2026 at 2:19 am

    try this :

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4       /loose.dtd">
    <html>
    <head>
    <title>Price Calculator</title>
    <script type="text/javascript">
    function isNumber(value) { 
        return typeof value === 'number' &&
                isFinite(value);
    }
    
    function fixOrder()
    {
        document.getElementById("total").value = "";  // clear the total field
        var numPrice = parseFloat(document.getElementById("cost").value);
        var taxP = parseFloat(document.getElementById("tax").value);
        //var total = parseFloat(document.getElementById("total").value);
    
        if (isNaN(numPrice)) { 
            alert("Sorry,you must enter a numeric value to place order");
            return;  // exit function to avoid calculation
        }
        if (isNaN(taxP)) {
            alert("Sorry, you must enter a numeric tax value to continue");
            return;  // exit function to avoid calculation
        }
    
        var tax = (numPrice * taxP)/100;
        var total = numPrice + tax;
        document.getElementById("total").value = "$" + total.toFixed(2);
    
     }
    
     </script>
    
     </head>
    
     <body bgcolor="#00f3F1">
    
    
    <h1 align="left">Price Calculator</h1>
    
    <form name="form">
    <p>
    Price:  <input type="text" id="cost" name="cost" value="" onchange="fixOrder();"/>
    </p>
    <p>
    Tax: &nbsp;
    <input type="text" id="tax" name="tax" value="" onchange="fixOrder();"/>
    </p>
    <p>
    Total: 
    <input type="text" id="total" name="total" value="" disabled="disabled"/>
    </p>
    </form>
    
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm been pounding on this problem all day. I've got a LinqDataSource that
There is this well-known problem that browsers don't put Ajax request in the request
This has been a problem that I haven't been able to figure out for
This is a really weird problem that I have been having. When I download
I am wondering how you would approach this problem I have two Taxrates that
Has anyone else run into this problem before? I've got a method that calls
I'm experiencing this weird problem which my scrollbar jumps by itself to somewhere that
This just won't work. The problem is that I do not know enough to
Never used a cache like this before. The problem is that I want to
This is my problem. I have a program that has to run in a

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.