Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# javascript calculate multiple check boxes

Posted on 2009-05-08
Medium Priority
177 Views
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
Question by:newbe101
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• Learn & ask questions
• 2

LVL 1

Accepted Solution

Alsaibai earned 2000 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>
``````
0

Author Comment

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

Author Closing Comment

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

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…
###### Suggested Courses
Course of the Month10 days, 5 hours left to enroll

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

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