www.fromthevalley.com.au

Radio Buttons and Javascript

HOW TO CHECK RADIO BUTTONS USING JAVASCRIPT
 
if((!document.form.<ELEMENT>[0].checked)&&(!document.form.<ELEMENT>[1].checked))
{ 
alert('ENTER IN MESSAGE'); 
return false;
} 
 
 
 
/ return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getCheckedValue(radioObj) {
if(!radioObj)
return "";
var radioLength = radioObj.length;
if(radioLength == undefined)
if(radioObj.checked)
return radioObj.value;
else
return "";
for(var i = 0; i < radioLength; i++) {
if(radioObj[i].checked) {
return radioObj[i].value;
}
}
return "";
}
HOMEAJAXAPACHEBizphoneCSSDNSGeneralGraphicsHTMLHardwareJavascriptLinuxMACMS SQLMailMicrosoftOFFICE 365PerlPostgresSEOSocial MediaVMwareWindows 10