js循环页面元素判断

<form name=form>
<input type=checkbox name=check1>
<input type=checkbox name=check2>
<input type=checkbox name=check3>
<input type=checkbox name=check4>
<input type=checkbox name=check5>
<input type=button name=kkkk value=检查 onclick=aa()>
<script language=javascript>

function aa()
{
var str="";
for (i=0;i<document.all.tags("input").length;i++)
{
if(document.all.tags("input")[i].type == "checkbox")
{
if(document.all.tags("input")[i].checked)
{
str=str+ (document.all.tags("input")[i].name)+";";
}
}
}
alert (str+"被选择了");
}
</script>
</form>

阅读更多

没有更多推荐了,返回首页