View Full Version : Unique way to tally qty boxes using Dom?? how
07-08-2004, 10:44 PM
Is there an effective way to grab all the qty dropdown input values and add them without reiterating thru all the element form objects on the page and then IF they have qty in their name, add the values....seems kinda overkill or outdated.....
Is there way to just grab the selected values of the select boxes that have 'qty' as part of the name??? Of course I can apply a unique ID, or NAME or Whatever to the qty dropdowns.....
07-08-2004, 10:55 PM
I do not think there is a magical way of determing if a form elements name contains qty without iterating thru the form elements......
Unless of course you want to start with all tagNames.
But now that would be overkill......
07-09-2004, 04:37 PM
Since your asking I've got to presume you have umpteen thousand selection lists -- else the looping through the form's elements & list's options would not be that tedious -- especially since it's the machine and not you doing it :)
<select ..... onchange='doit(this.name, this.selectedIndex)'
var selNdces = new Array();
function doit(selName, ndx)
selNdces[selName] = ndx;
you can then access them with:
for (theName in selNdces)
alert(theName + ' = ' + selNdces[theName])
or if you want the list's value:
for (theSel in selNdces)
oSel = document.formname[theSel] // replace with the form's name
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.