Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

i want to add values from 5 drop down boxes 1

Status
Not open for further replies.

elizabeth1987

Programmer
Feb 17, 2010
2
GB
Hi guys, i'm trying to develop a code for my sister, i would like to use javascript to finish off the following tasks:

1. I want to be able to select marks from 0 to 30, from 5 drop down boxes.
2. and as marks are selected, it should upgrade the total.
3. and then show me the total marks when finished.

i've got up to creating the drop down boxes, now it's just adding the values once selected.

Thanks! any help would be great :) :)
 
What have you tried?

Adding is not difficult, and as long as you know how to reference the drop downs it should be simple using the Onchange event of each dropdown.

Code:
var dropdown1=document.getElementById('firstdropdown');
var dropdown2=document.getElementById('seconddropdown');
...

var resultbox=document.getElementById('resultbox');

resultbox.value=parseInt(dropdown1.value)+parseInt(dropdown2.value)+....;
}





----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top