Solved

javascript calculate multiple check boxes

Posted on 2009-05-08
3
166 Views
Last Modified: 2012-05-06
Hi all,
I have been scouring all over google for an example.  I am looking for an example javascript that can calculate multiple textboxes...
Quantity * Value
--------------------
Box1 * Box2
     +
Box3 * Box4
...etc...
= Total
Any examples will be appreciated.
0
Comment
Question by:newbe101
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
Alsaibai earned 500 total points
ID: 24341600
I hope this will help you out...

<SCRIPT LANGUAGE="JavaScript"> 

  

<!-- Begin

function  doMath() {

var one = eval(document.theForm.elements[0].value)

var two = eval(document.theForm.elements[1].value)

var prod = one  *   two

alert("The product of "  +  one  +  " and "  +

two  +  " is "  +  prod  +  ".")

}

// End -->

</SCRIPT>

<CENTER>

<FORM NAME="theForm">

Multiply

<INPUT TYPE="text">

 By

<INPUT TYPE="text">

<INPUT TYPE="button" VALUE="Show result" onClick="doMath()">

</FORM>

</CENTER>

Open in new window

0
 

Author Comment

by:newbe101
ID: 24341605
thanks for the example... I am going to check it out.
0
 

Author Closing Comment

by:newbe101
ID: 31579688
thanks... you got me going in the right direction
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now