获取radio:
<SCRIPT LANGUAGE="JavaScript">
<!--
function zmaa(){
var chkObj = document.getElementById("SHYK_KBN");
var chkArr1 = document.getElementsByName("SHYK_KBN");
var chkArr2 = document.all.item("SHYK_KBN");
var chkArr3 = document.all("SHYK_KBN");
alert(chkObj.outerHTML);
alert(chkArr1.length);
alert(chkArr2.length);
alert(chkArr3.length);
alert(chkArr3[1].value);
}
//-->
</SCRIPT>
<FORM name = "zm" METHOD=POST ACTION="">
<input type="radio" id="SHYK_KBN" value="1" size="88">
<input type="radio" id="SHYK_KBN" value="2" checked>
<input type="radio" id="SHYK_KBN" value="3" >
<input type="radio" id="SHYK_KBN" value="4" > <br>
<BR>
<INPUT TYPE="button" onclick="zmaa()" value = "9999">
</FORM>
结论:
getElementById方法只能取到第一个radio对象,
var chkArr1 = document.getElementsByName("SHYK_KBN");
var chkArr2 = document.all.item("SHYK_KBN");
var chkArr3 = document.all("SHYK_KBN");
上面的三种方式均可以取到一个radio对象数组。
获取radio的属性
document.form1.face.checked=true;