javascript calculate multiple check boxes

Posted on 2009-05-08
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
= Total
Any examples will be appreciated.
Question by:newbe101
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

Accepted Solution

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

<!-- 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 -->
<FORM NAME="theForm">
<INPUT TYPE="text">
<INPUT TYPE="text">
<INPUT TYPE="button" VALUE="Show result" onClick="doMath()">

Open in new window


Author Comment

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

Author Closing Comment

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

Featured Post

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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

617 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