Posts: 312
Name: Jason Eyermann
Location: england bristol
|
PROBLEM NOW SOLVED
I'm just trying to get a value from a checkbox with javascript for a price for an automatic price calculator.
-------
eg-<input type="checkbox" id="advert01" name="advert01" value="yes">
--------
I tried getting the value a number of ways but doesn't seem to work
i've tried - var checkboxValue = document.formname.advert.value
also
if (document.formname.advert.checked) {
checkboxValue = "300";
} else {
checkboxValue = "10";
}
but the value always comes up as 10. I also tried the ischecked function.
I've search google. can't find anything. I lost an hour today at work trying to sort this out. I've already got the info from about 50 text fields and 10 dropdowns. I just can't do it for the check box.
Can anyone enlighten me.
Last edited by jason_bristol; 02-12-2010 at 12:45 PM..
|