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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:22:37+00:00 2026-06-07T15:22:37+00:00

I’m trying to create a JavaScript lease calculator where a user will enter an

  • 0

I’m trying to create a JavaScript lease calculator where a user will enter an input (purchase price) and based on the amount that is input will produce a calculation (which further I will add a range to go a certain percentage higher and lower than the calculated number).

Here is an example from my javascript:

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function aplusb(form) {

a=eval(Calc.num1.value)

if (a < 1000)
  {
  b= 0.05372
  c=a * b
  Calc.Input.value = c
  Calc.Input2.value = c - (c * 0.15)
  Calc.Input3.value = c + (c * 0.15))
  }
else if (1001 < a < 2000)
  {
  b= 0.04875
  c=a * b
  Calc.Input.value = c
  Calc.Input2.value = c - (c * 0.15)
  Calc.Input3.value = c + (c * 0.15))
  }
else
  {
  b= 0.04689
  c=a * b
  Calc.Input.value = c
  Calc.Input2.value = c - (c * 0.15)
  Calc.Input3.value = c + (c * 0.15))
  }
}

</script>

and the html i’m using to call the script

<form name="Calc" action="--WEBBOT-SELF--" method="POST">
<p>

Enter Purchase Price:
<input type="text" name="num1" size="12" tabindex="1">

<br> Calculation: <input type="text" name="Input" size="17" tabindex="4">

Range
<input type="text" name="Input2" size="17" tabindex="4">
<input type="text" name="Input3" size="17" tabindex="4">

</p>
<input type="button" name="sum"  value="Calculate" OnClick="aplusb(this.form)" tabindex="3">
</form>

The script works fine if it’s just doing the same calculation on any number, but as soon as I add the “if” command, it doesn’t work after that. Essentially there will be a group of about 10 if else commands.
Any help would be much appreciated! 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-07T15:22:38+00:00Added an answer on June 7, 2026 at 3:22 pm

    Your main problem is the lack of semicolons and the lines with double )) such as:

    Calc.Input3.value = c + (c * 0.15))
    

    Fixed with:

    Calc.Input3.value = c + (c * 0.15);
    

    Here is a fixed version: http://jsbin.com/atelen/edit#preview

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

Sidebar

Related Questions

I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I need a function that will clean a strings' special characters. I do NOT
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small

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.