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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:50:56+00:00 2026-05-26T04:50:56+00:00

Possible Duplicate: When I press enter I get isNaN, but the value is a

  • 0

Possible Duplicate:
When I press enter I get isNaN, but the value is a number

I turn in my homework last Sunday.It was sent back to me for correction because the isNaN value was returned to the Total textbox.I thought that is what is was programmed to do. Instead, according to her, “The isNaN function will examine the variable and determine if the variable holds non-numeric data, then the next statement will change the content of the variable to set to zero,” which has me confused. Any suggestions Here is the code. *The “return;” statements were not a syntax error before I made changes. Here is the link to the uploaded file: ciswebs.smc.edu/cis54/tyson_schweidel/homework2.htm

<!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");
    return; //gets syntax error
}


var tax = (numPrice * taxP)/100;{
var total = numPrice + tax;
numPrice = 0;
taxP = 0;
    document.getElementById("total").value = "$" + total.toFixed(2);
return; //gets syntax error
}
</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>

  • 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-26T04:50:56+00:00Added an answer on May 26, 2026 at 4:50 am

    You variables are not in scope when the isNaN() function attempts to check them.

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

Sidebar

Related Questions

Possible Duplicate: When I press enter I get isNaN, but the value is a
Possible Duplicate: Run Jquery method when enter key is press I am trying to
Possible Duplicate: Disable back button in android i don't want to dismiss my dialog
Possible Duplicate: array_splice() for associative arrays How to add an array value to the
Possible Duplicate: PHP get all arguments as array? Within a javascript function arguments always
Possible Duplicate: Can you call Directory.GetFiles() with multiple filters? Does it possible to get
Possible Duplicate: What is 0x10 in decimal? I notice that Console.WriteLine(18); writes 18, but
Possible Duplicate: How an uninitialised variable gets a garbage value? So when an undefined
Possible Duplicate: How to store an IP in mySQL I want to get the
Possible Duplicate: C/C++: Capture characters from standard input without waiting for enter to be

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.