怎样得到页面中所有CHECKBOX的集合? 将id值设置成一样的,用getElementbyId 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <script language="javascript"><!-- function funcheck() { var ingc; for (ingc=0;ingc<document.all.length;ingc++) { if (document.all(ingc).type == 'checkbox') { alert("找到的checkbox的名为:"+document.all(ingc).name); } } }//--></script><input type=checkbox name=C1><input type=checkbox name=C2><input type=checkbox name=C3><input type=checkbox name=C4><input type=checkbox name=C5><input type=button name=B1 value=check onclick="funcheck();"> <form><input type="checkbox" name=""><input type="checkbox" name=""><input type="checkbox" name=""><input type="checkbox" name=""><input type="checkbox" name=""><input type="checkbox" name=""><input type="checkbox" name=""><input type="password"><input type="radio" name=""><input type="password"><input type="checkbox" name=""><input type="reset"><input type="password"><input type="checkbox" name=""><input type="password"></form><input type="button" onclick="for(var i=0,j=0, obj=document.getElementsByTagName('INPUT');i<obj.length;i++){if(obj[i].type=='checkbox'){j++};};alert(j)"> or~~~<script language="javascript"><!-- function funcheck() { var o = document.getElementsByName("D1"); var ingc; for (ingc=0;ingc<o.length;ingc++) { if (o[ingc].type == 'checkbox') alert("检索到的checkbox的名为:"+o[ingc].name); } }//--></script><input type=checkbox name=C1 id=D1><input type=checkbox name=C2 id=D1><input type=checkbox name=C3 id=D1><input type=checkbox name=C4 id=D1><input type=checkbox name=C5 id=D1><input type=button name=B1 value=check onclick="funcheck();"> checkbox的name设成一样就可以了啊 mjpclab(我是大猫猫啊 http://mjpclab.8u8.com)type 返回的是 [object],不是 checkbox你确定 :) 不用typeof()的话,不会返回[object]呀zltostem(尘寞)的方法我试了,可以的 显示不全加上滚动条也显示不出来? 关于BS程序的性能问题!迷惑~!! 如何获得html元素的id值? JS编辑器即时显示问题 急!急!急!如何用js获取浏览器的url然后返回一张图片??? 求教javascript有什么好的绑定list的框架? 请教:如何把这个span和内容通过正则式过滤掉? 在WORD里,可以对一篇文章中的中英文设置不同的字体,那么HTML文档中是否也可以做到这一点? javascript的权限问题 秋水,能给我个解释吗? 高分求解,javascript的问题!!! 急救:怎么通过javascript调用局域网机子上的程序?
<!--
function funcheck()
{
var ingc;
for (ingc=0;ingc<document.all.length;ingc++)
{
if (document.all(ingc).type == 'checkbox')
{
alert("找到的checkbox的名为:"+document.all(ingc).name);
}
}
}
//-->
</script><input type=checkbox name=C1>
<input type=checkbox name=C2>
<input type=checkbox name=C3>
<input type=checkbox name=C4>
<input type=checkbox name=C5>
<input type=button name=B1 value=check onclick="funcheck();">
<input type="checkbox" name="">
<input type="checkbox" name=""><input type="checkbox" name=""><input type="checkbox" name=""><input type="checkbox" name=""><input type="checkbox" name=""><input type="checkbox" name=""><input type="password"><input type="radio" name=""><input type="password"><input type="checkbox" name=""><input type="reset"><input type="password"><input type="checkbox" name=""><input type="password">
</form>
<input type="button" onclick="for(var i=0,j=0, obj=document.getElementsByTagName('INPUT');i<obj.length;i++){if(obj[i].type=='checkbox'){j++};};alert(j)">
<script language="javascript">
<!--
function funcheck()
{
var o = document.getElementsByName("D1");
var ingc;
for (ingc=0;ingc<o.length;ingc++)
{
if (o[ingc].type == 'checkbox')
alert("检索到的checkbox的名为:"+o[ingc].name);
}
}
//-->
</script><input type=checkbox name=C1 id=D1>
<input type=checkbox name=C2 id=D1>
<input type=checkbox name=C3 id=D1>
<input type=checkbox name=C4 id=D1>
<input type=checkbox name=C5 id=D1>
<input type=button name=B1 value=check onclick="funcheck();">
zltostem(尘寞)的方法我试了,可以的