小弟新学 JAVAscript
书本上有个题目是实现全选全不选的功能
自己编的代码如下:
<html>
<head>
<title>复选框的全选和全不选</title>
<script language="javascript">
function checkAll()
{
   var allCheckBoxs=document.getElementByName("coffee");
   var i;
   for(i=0;i<allCheckBoxs.length;i++)
  {  
    allCheckBoxs[i].checked=ture;
  
  }
}
function notCheckAll()
{
   var allCheckBoxs=document.getElementByName("coffee");
   var i;
   for(i=0;i<allCheckBoxs.length;i++)
  {
    allCheckBoxs[i].checked=false;
  
  }
 }
</script>
</head><body>
<p><h3>你喜欢喝那种类型的咖啡</h3></p>
<form>
<input type="checkbox" name="coffee" value="cream">蓝山咖啡
<br><input type="checkbox" name="coffee" value="mocha">摩卡
<br><input type="checkbox" name="coffee" value="latte">拿铁
<br><input type="checkbox" name="coffee" value="Cappuccino">卡布其诺
<br><input type="checkbox" name="coffee" value="Ireland">爱尔兰咖啡
<br><input type="button" name="openButton1" value="全选" onClick="checkAll()">
<input type="button" name="openButton2" value="全不选" onclick="notCheckAll()">
</form>
</body>
</html>不知道哪里有错误。。总是实现不了。。希望高手帮忙解决