是这样的 我有个 复选框ID=a 在js里面 页面一加载 它就自动选上 用jquery怎么做?
<body>
<input type='checkbox' id='a'/>
</body>
<script>
$('#a').attr('checked',true);
</script>
function(){ document.getElementById("a").checked =true;}
<html>
<head>
<title></title>
<script src="jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
document.getElementById('a').checked = 'true';
});
</script>
</head>
<body>
<input type='checkbox' id='a' value='hello,world!'>hello,world!
</body>
</html>
楼上正解,放在类加载事件里面就行