function getRadioValue(name) { var radio = document.getElementsByName(name); for (var i in radio) if (radio.hasOwnProperty(i)) if (radio[i].checked) return radio[i].value; return false; } alert(getRadioValue("test"));