手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >js 判断checkbox是否选中的实现代码
js 判断checkbox是否选中的实现代码
摘要://第几个没有选functioncheck(obj){for(i=0;i

//第几个没有选

<input type="checkbox" name="checkbox1" checked>

<input type="checkbox" name="checkbox1">

<input type="checkbox" name="checkbox1" checked>

<input type="checkbox" name="checkbox1">

<input type="checkbox" name="checkbox1">

<script language=javascript>

function check(obj)

{

for(i=0;i<document.all(obj).length;i++)

{

if(!document.all(obj)[i].checked)alert("第"+(i+1)+"个没有选择")

}

}

</script>

<input type=button value="检测">

//一个也没有选

<input type="checkbox" name="test">

<input type="checkbox" name="test">

<input type="checkbox" name="test">

<input type="checkbox" name="test">

<input type="checkbox" name="test">

<Script Language="JavaScript">

function check(obj){

for(i=0;i<document.all(obj).length;i++){

if(document.all(obj)(i).checked){

return;

}

}

window.alert('一个也没有选!');

}

</Script>

<input type=button value="检测">

//第几个没有选

<input type="checkbox" name="checkbox1" checked>

<input type="checkbox" name="checkbox1">

<input type="checkbox" name="checkbox1" checked>

<input type="checkbox" name="checkbox1">

<input type="checkbox" name="checkbox1">

<script language=javascript>

function check(obj)

{

for(i=0;i<document.all(obj).length;i++)

{

if(!document.all(obj)[i].checked)alert("第"+(i+1)+"个没有选择")

}

}

</script>

<input type=button value="检测">

//一个也没有选

<input type="checkbox" name="test">

<input type="checkbox" name="test">

<input type="checkbox" name="test">

<input type="checkbox" name="test">

<input type="checkbox" name="test">

<Script Language="JavaScript">

function check(obj){

for(i=0;i<document.all(obj).length;i++){

if(document.all(obj)(i).checked){

return;

}

}

window.alert('一个也没有选!');

}

</Script>

<input type=button value="检测">

【js 判断checkbox是否选中的实现代码】相关文章:

jQuery判断指定id的对象是否存在的方法

Ctrl + Enter提交前检测的代码

判断是否输入完毕再激活提交按钮

带Checkbox的列表框

让插入到 innerHTML 中的 script 跑起来的实现代码

判断Checkbox和Radio的一种方法

判断checkbox选择的个数 多浏览器

JavaScript判断数组是否包含指定元素的方法

js去字符串前后空格的实现方法

CheckBox 如何实现全选?

精品推荐
分类导航