在线等:下面代码中的两个函数为什么不能执行的?
在另外一个文件中可以正常运行,把它拷贝到一个新文件中,改了一下form的名字什么的就不行了。真是邪门了。
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<script language="JavaScript">
function clickall(v)
{
var f=document.forms["Decoy"];
alert(f.elements.length);
for (i=1;i<f.elements.length;i++)
f.elements[i].checked=v;
document.forms["Decoy"].elements["ClearAll"].checked=0;
}
function clearall()
{
var f=document.forms["Decoy"];
for (i=1;i<f.elements.length;i++)
f.elements[i].checked=0;
document.forms["Decoy"].elements["ClickAll"].checked=0;
}
}
</script>
<form name="Decoy" method="post" action="decoy_pic.asp">
<input type='checkbox' name='picture1' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture2' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture1' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture2' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture1' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture2' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture1' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture2' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture1' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture2' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture1' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture2' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture1' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture2' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture1' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture2' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture1' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture2' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture1' value='true' title='Please click me to select the above picture as a decoy-picture!'>
<input type='checkbox' name='picture2' value='true' title='Please click me to select the above picture as a decoy-picture!'><br>
<input type="radio" name="ClickAll" OnClick="clickall(this.checked)"> Select All Pictures as Decoys
<input type="radio" name="ClearAll" OnClick="clearall()"> Clear All Pictures
</form>
</body>
</html>