function check()
{
var radionum=0;
var a = document.getElementsByTagName("input");
for (var i=0; i<a.length; i++){
if ((a[i].type == "radio")&&(a[i].checked))
radionum++;
}
if (radionum==0)
{
alert(‘you must choose one.‘);
return false;
}
return true;
}
---------------------------------------------------------------
getElementsByTagName根据html标记获取相应对象
批量校验radio(转)
时间: 2024-10-14 04:09:18