如何用JavaScript判断radio是否选中
2009-06-20 02:40
507 查看
如何用JAVAScript判断radio是否选中 [已结帖,结帖人:sunhongxiang] .
[华 软 网]
编程论坛 楼主 在写JAVAScript的时候,如何判断单选按钮是否被选中,并且在什么时候调用,急啊!!!! .
[华 软 网]
编程论坛 1 个网友回答: if( xxx.checked )
...... .
[华 软 网]
编程论坛 2 个网友回答:
比如这样:
<script>
function check()
{
for(i=0;i <document.form1.r1.length;i++)
if(document.form1.r1[i].checked)
{alert(document.form1.r1[i].value);return;}
}
</script>
<form name=form1>
<input type=radio name=r1 value=1>
<input type=radio name=r1 value=2>
<input type=radio name=r1 value=3>
<input type=button onclick=check()>
</form> .
[华 软 网]
编程论坛 3 个网友回答: 可以在radio的onclick事件中判断是否选中 .
[华 软 网]
编程论坛 4 个网友回答: 我在这也问个,复选框也是一样的吧,但是如果要进行批量删除时(全选),这时是如何判断实现啊 .
[华 软 网]
编程论坛 5 个网友回答:
HTML code
[华 软 网]
编程论坛 6 个网友回答: 循环判断 .
[华 软 网]
编程论坛 7 个网友回答:
HTML code
[华 软 网]
编程论坛 8 个网友回答: checked属性 .
[华 软 网]
编程论坛 9 个网友回答: document.getElementById("ID").checked .
[华 软 网]
编程论坛 10 个网友回答:
引用 2 楼 rocketsuperman 的回复:
比如这样:
<script>
function check()
{
for(i=0;i <document.form1.r1.length;i++)
if(document.form1.r1[i].checked)
{alert(document.form1.r1[i].value);return;}
}
</script>
<form name=form1>
<input type=radio name=r1 value=1>
<input type=radio name=r1 value=2>
<input type=radio name=r1 value=3>
<input type=button onclic…
引用 2 楼 rocketsuperman 的回复:
比如这样:
<script>
function check()
{
for(i=0;i <document.form1.r1.length;i++)
if(document.form1.r1[i].checked)
{alert(document.form1.r1[i].value);return;}
}
</script>
<form name=form1>
<input type=radio name=r1 value=1>
<input type=radio name=r1 value=2>
<input type=radio name=r1 value=3>
<input type=button onclic…
[华 软 网]
编程论坛 楼主 在写JAVAScript的时候,如何判断单选按钮是否被选中,并且在什么时候调用,急啊!!!! .
[华 软 网]
编程论坛 1 个网友回答: if( xxx.checked )
...... .
[华 软 网]
编程论坛 2 个网友回答:
比如这样:
<script>
function check()
{
for(i=0;i <document.form1.r1.length;i++)
if(document.form1.r1[i].checked)
{alert(document.form1.r1[i].value);return;}
}
</script>
<form name=form1>
<input type=radio name=r1 value=1>
<input type=radio name=r1 value=2>
<input type=radio name=r1 value=3>
<input type=button onclick=check()>
</form> .
[华 软 网]
编程论坛 3 个网友回答: 可以在radio的onclick事件中判断是否选中 .
[华 软 网]
编程论坛 4 个网友回答: 我在这也问个,复选框也是一样的吧,但是如果要进行批量删除时(全选),这时是如何判断实现啊 .
[华 软 网]
编程论坛 5 个网友回答:
HTML code
<script> function check() { for(i=0;i <document.form1.r1.length;i++) if(document.form1.r1[i].checked) {alert(document.form1.r1[i].value);return;} } </script> <form name=form1> <input type=radio name=r1 value=1> <input type=radio name=r1 value=2> <input type=radio name=r1 value=3> <input type=button onclick=check()> </form>.
[华 软 网]
编程论坛 6 个网友回答: 循环判断 .
[华 软 网]
编程论坛 7 个网友回答:
HTML code
<script> function check() { for(i=0;i <document.form1.r1.length;i++) if(document.form1.r1[i].checked) {alert(document.form1.r1[i].value);return;} } </script> <form name=form1> <input type=radio name=r1 value=1> <input type=radio name=r1 value=2> <input type=radio name=r1 value=3> <input type=button onclick=check()> </form>.
[华 软 网]
编程论坛 8 个网友回答: checked属性 .
[华 软 网]
编程论坛 9 个网友回答: document.getElementById("ID").checked .
[华 软 网]
编程论坛 10 个网友回答:
引用 2 楼 rocketsuperman 的回复:
比如这样:
<script>
function check()
{
for(i=0;i <document.form1.r1.length;i++)
if(document.form1.r1[i].checked)
{alert(document.form1.r1[i].value);return;}
}
</script>
<form name=form1>
<input type=radio name=r1 value=1>
<input type=radio name=r1 value=2>
<input type=radio name=r1 value=3>
<input type=button onclic…
引用 2 楼 rocketsuperman 的回复:
比如这样:
<script>
function check()
{
for(i=0;i <document.form1.r1.length;i++)
if(document.form1.r1[i].checked)
{alert(document.form1.r1[i].value);return;}
}
</script>
<form name=form1>
<input type=radio name=r1 value=1>
<input type=radio name=r1 value=2>
<input type=radio name=r1 value=3>
<input type=button onclic…
相关文章推荐
- javascript循环判断Radio是否选中
- javascript 判断radio单选按钮是否为选中状态,并弹出选中值
- JavaScript判断Form中的Radio是否有未选中的
- javascript中判断radio是否选中的方法
- javascript判断radio是否选中
- Javascript 判断radio是否选中及RegExp正则表达式
- javascript 判断radiobox是否选中
- javascript判断radio是否选中
- JavaScript判断Form中的Radio是否有未选中的
- jsp中,使用javascript判断radio是否有选中!
- javascript判断单选框是否选中
- jquery 判断checkbox 是否选中和如何动态选中一个checkbox
- [WinForm每日一帖] 如何判断UltraGrid中是否选中数据
- 如何判断Javascript对象是否存在
- jQuery如何判断和设定单选多选是否选中??
- 如何用JavaScript判断客户端浏览器是否安装了Flash插件,及其版本?【转】
- js如何判断复选框是否选中
- 如何判断Javascript对象是否存在
- JavaScript 如何判断一个对象{}是否为空对象
- javascript中如何判断字符串是否为日期