Sunday, 10 October 2010

Get value from radio button

I dont know why. but it took me a while to search the javascript code for this(getting value from radio button). Guess its because I'm not that expert at all in this field. (>_<) .But, Alhamdulillah, not long after that, the problem is solved .and thanks to xavisys , for providing me with the solution.

below are the script:

var radioGrp = document['forms']['form_name']['element_name'];
for(i=0; i < radioGrp.length; i++){
if (radioGrp[i].checked == true) {
var theValue = radioGrp[i].value;
}
}


thats all people~ (^_^)

ps: gotta finish my FYP!

No comments: