手机
当前位置:查字典教程网 >编程开发 >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是否选中的实现代码】相关文章:

JS动画效果打开、关闭层的实现方法

网页里控制图片大小的相关代码

jquery判断至少有一个checkbox被选中的方法

javascript中this的四种用法

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

javascript结合Flexbox简单实现滑动拼图游戏

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

jquery实现的判断倒计时是否结束代码

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

JavaScript检测字符串中是否含有html标签实现方法

精品推荐
分类导航