jQuery提供许多过滤选择器,用来处理更复杂的选择,很多时希望知道用户所选中复选,都是通过属性来断定,那么只有得到初状态下的选中状态的选中情况。
下面写一个。。第一步用Aptana创建一个jQuery项目
<script type="text/javascript" src="lib/jquery/jquery.js">
</script>
<body>
<style>
.myclass {
background-color: #ff0000;
text-decoration: underline;
}
</style>
<script language=javascript>
function showstyle(box){
$("input[name=" + box + "]:checked").addClass("myclass");//:checked代表所选中的多选给它添加样式
}
</script>
<input type=checkbox name=sport>aaa<input type=checkbox name=sport>vv<input type=checkbox name=sport>bbb<input type=button name=sport onclick=showstyle('sport');>aaa
</body>
?