您的位置:首页 > 其它

判断复选框是否被选中

2008-05-28 14:40 218 查看
function  checkValue()  {     var input_list = document.getElementsByTagName("input");  for (i=0; i< input_list.length; i ++) {  thisInput = input_list[i];  if(thisInput.type.toLowerCase()=="checkbox"){   if(getCheckedValue(document.getElementsByName(thisInput.name)) == ""){    thisInput.focus();    window.scrollBy(0, -30);    alert("该项不能为空!");    return false;   }  } }   return true;}
 
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 "";}
 
 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  input function list