Return to Snippet

Revision: 2261
at January 26, 2007 00:17 by ib_designer


Initial Code
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 "";
}

Initial URL

                                

Initial Description
/* How to use */
var prima  = getCheckedValue(document.forms["myForm"].elements['myRadio'])

Initial Title
fn. get radio button value

Initial Tags

                                

Initial Language
JavaScript