0

Possible Duplicate:
Get Radio Button Value with Javascript

I'm trying to post my input data. Most of it is in text boxes but one field is a radio button. I'm not sure the syntax is correct.

var myProps = [];
            var type = document.getElementByName().value;

        function addProp(id) {
            if type = "text" {
            var value = encodeURIComponent(document.getElementById(id).value);
            }
            if type = "radio" {
            var value = encodeURIComponent(valueRadioButtonList(id).value);
            }
            myProps.push(id + "=" + value);
        }

        addProp('child_name');
        addProp('age');
        addProp('hometown');
        addProp('boy_girl');
            addProp('first_name');
        addProp('last_name');
        addProp('email');
        addProp('address1');
        addProp('address2');
        addProp('city');
        addProp('state');
        addProp('zip');
        addProp('country');

xmlhttp.send(myProps.join("&"));
Community
  • 1
  • 1
CTViking
  • 99
  • 1
  • 5

0 Answers0