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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:49:23+00:00 2026-06-09T12:49:23+00:00

I need a function to determine: (1) if two inputs have values, throw an

  • 0

I need a function to determine: (1) if two inputs have values, throw an error. (2) if neither input has value, throw an error. (3) if input B or input D has a value, determine which Calculate function to then use. Both Calculate functions work, when called as

onClick="Calculate(this.form.input_A.value, this.form.input_B.value, this.form.input_C.value, this.form)"
onClick="Calculate2(this.form.input_A.value, this.form.input_C.value, this.form.input_D.value, this.form)"

But when I use to call the function below:

onclick="compute();"

The errors work, but I’m not calling the Calculate functions right, I’m sure its something obvious but I can’t see it. The answer is no longer getting displayed, as it was before the error function was added.

<SCRIPT LANGUAGE="JavaScript">

function compute() {
  var B = document.getElementById("input_B").value;
  var D = document.getElementById("input_D").value;

  if (B != "" && D != "") {
    alert("You may only enter Assessment or Annual Property Taxes.");
  } else if (B != "") {
    Calculate(B);
  } else if (D != "") {
    Calculate2(D);
  } else {
    alert("You must enter a value into either Assessment or Annual Property Taxes.");
  }
}

function Calculate(Atext, Btext, Ctext, form) {
  var A = parseFloat(Atext);
  var B = parseFloat(Btext);
  var C = parseFloat(Ctext);
  form.Answer.value = ((B - A) * C) / 1000;
}

function Calculate2(Atext, Ctext, Dtext, form) {
  var A = parseFloat(Atext);
  var C = parseFloat(Ctext);
  var D = parseFloat(Dtext);
  form.Answer.value = D - ((A * C) / 1000);
}

function ClearForm(form) {
  form.input_A.value = "";
  form.input_B.value = "";
  form.input_C.value = "";
  form.input_D.value = "";
  form.Answer.value = "";
}

</SCRIPT>
  • 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-09T12:49:25+00:00Added an answer on June 9, 2026 at 12:49 pm

    You are missing the arguments and not calling the functions correctly.
    Try the following…

    function compute() {   
        var B = document.getElementById("input_B").value;   
        var D = document.getElementById("input_D").value;    
        var A = document.getElementById("input_A").value;   
        var C = document.getElementById("input_C").value; 
    
        if (B != "" && D != "") {     
            alert("You may only enter Assessment or Annual Property Taxes.");   
        } else if (B != "") {     
            Calculate(A, B, C, this.forms[0]);   
        } else if (D != "") {     
            Calculate2(A, C, D, this.forms[0]);   } 
        else {     
            alert("You must enter a value into either Assessment or Annual Property Taxes.");   
        } 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two multidimensional arrays that I need to determine the delta for each
I need to be able to compute differences between two data/time values which represent
I need a function to determine if a directory is a mount point for
I need a function that can print Turkish characters. public String convert(String input) {
I need a function which returns true if the certificate of a secure website
So I have a function that merges two arrays replacing variables that are in
I have a Windows Service which performs a certain function, and then needs to
I'm trying to combine two queries in order to determine which aircraft will be
I need to make a program, ioloop.c, which takes two command line parameters that
in function need key to encrypt string without mcrypt libraly in php function encrypt($str,

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.