Advertisement

03.15.2008 at 11:28PM PDT, ID: 23244883
[x]
Attachment Details

Javascript Multiplication of 3 html form values

Asked by it_orders in JavaScript, Hypertext Markup Language (HTML)

Tags:

I have a form with 3 values that need to be multiplied, the results need to be delivered in realtime to the form. At this point all I am getting is an alert window, the answer is correct in the alert window, but I cannot get the value to populate in the form realtime. Any help is appreciated and welcomed!!!
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
function multiply(val1, val2, val3,multiplyresultTarget250)
{
      val1 = parseInt( String(val1).replace(/^\s+/,"").replace(/\s+$/,""));
      //val2 = parseInt(String(val2).replace(/^\s+/,"").replace(/\s+$/,""));
      val2 = val2;
      val3 = parseInt(String(val3).replace(/^\s+/,"").replace(/\s+$/,""));
      vala = val2/100;
 
      if( !isNaN(val1) && !isNaN(val2) )
      {
       if( val2 > 0.0 )
        {
            var result = val1*val3*(val2/100);
            if( multiplyresultTarget250 )
            document.getElementById(multiplyresultTarget250).value = result;
            else
                //alert("The result is: " + result.toFixed() );
            document.getElementById(multiplyresultTarget250).value = result;
        }
        else
        {
            alert("Quantity must be greater than zero");
        }
      }
    else
    {
        alert("invalid value detected")
        return false;//you could just return count250 as if you forced a division by 1
    }
return result;
}
[+][-]03.16.2008 at 12:41AM PDT, ID: 21136073

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JavaScript, Hypertext Markup Language (HTML)
Tags: javascript html
Sign Up Now!
Solution Provided By: dxz2
Participating Experts: 2
Solution Grade: A
 
 
[+][-]03.16.2008 at 02:17AM PDT, ID: 21136242

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.16.2008 at 02:58PM PDT, ID: 21138703

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.16.2008 at 03:35PM PDT, ID: 21138842

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.16.2008 at 06:56PM PDT, ID: 21139431

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.17.2008 at 11:38AM PDT, ID: 21144847

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.17.2008 at 01:32PM PDT, ID: 21145842

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628