日期:2014-05-17  浏览次数:21054 次

超级简单问题
<table   width= "100% ">
<tr>
<td   align= "right ">
<input   type= "button "   name= "all "   id= "all "   value= "Select   All "   onClick= "checked() "   />
<input   type= "checkbox "   name= "a "   id= "a "   />
</td>
</tr>
</table>
<script>
function   checked()
{          
    document.getElementById( "EmailID ").checked;
}
</script>

我的意思是点那按钮的时候,就能让checkbox选中,但是试了下不行,我有忘了怎么写了,请大家指点下

------解决方案--------------------
document.getElementById( "EmailID ").checked=true;
------解决方案--------------------

1、函数名字,不要用checked
2、复选框的ID是a,要改为EmailID
还有其他不规范的地方。大体帮改了一下:

<input type= "button " name= "all " id= "all " value= "Select All " onClick= "checkit(); ">
<input type= "checkbox " name= "a " ID= "EmailID ">

<script language=javascript>
function checkit()
{
document.getElementById( "EmailID ").checked = true;
}
</script>