[讨论]为什么这个函数换种写法就不行了呢?
<script language="javascript">
为什么换成这样怎么就不对啊??function CheckAll(form)
{
for (var i=0;i<form.elements.length;i++)
{
var e = form.elements[i];
if (e.name != 'chkall')
e.checked = form.chkall.checked;
}
}
</script>
<form name="form1" method="post" action="del.asp">
<input type="checkbox" name="DelID" id=DelID value=<%=对应的代码%>>
............... '对应的内容自己补充
<input type="checkbox" name="chkall" onClick="CheckAll(this.form)">选中所有
<input type="submit" name="sumbit" value="删除" />
<input type="reset" name="sumbit2" value="重置" >
</form>
{
for (var i=0;i<form.elements.length;i++)
{
var e = form.elements[i];
if (e.name != 'chkall')
e.checked = form.chkall.checked;
}
}
</script>
<form name="form1" method="post" action="del.asp">
<input type="checkbox" name="DelID" id=DelID value=<%=对应的代码%>>
............... '对应的内容自己补充
<input type="checkbox" name="chkall" onClick="CheckAll(this.form)">选中所有
<input type="submit" name="sumbit" value="删除" />
<input type="reset" name="sumbit2" value="重置" >
</form>
<script language="javascript">
function CheckAll(form)
{
for (var i=0;i<form.elements.length;i++)
{
if (form.elements[i].name != 'chkall')
e.checked = form.chkall.checked;
}
}
</script>
<form name="form1" method="post" action="del.asp">
<input type="checkbox" name="DelID" id=DelID value=<%=对应的代码%>>
............... '对应的内容自己补充
<input type="checkbox" name="chkall" onClick="CheckAll(this.form)">选中所有
<input type="submit" name="sumbit" value="删除" />
<input type="reset" name="sumbit2" value="重置" >
</form>
function CheckAll(form)
{
for (var i=0;i<form.elements.length;i++)
{
if (form.elements[i].name != 'chkall')
e.checked = form.chkall.checked;
}
}
</script>
<form name="form1" method="post" action="del.asp">
<input type="checkbox" name="DelID" id=DelID value=<%=对应的代码%>>
............... '对应的内容自己补充
<input type="checkbox" name="chkall" onClick="CheckAll(this.form)">选中所有
<input type="submit" name="sumbit" value="删除" />
<input type="reset" name="sumbit2" value="重置" >
</form>
[此贴子已经被作者于2007-9-25 20:50:37编辑过]