CSS
- 为什么要使用通配符设置padding 和margin ,因为很多标签自带了内边距和外边距,我们需要把这些标签自带的内边距和外边距清空
- margin: 0 auto 为了让块元素左右居中
jQuery
多选框
- 如果属性值返回True false 使用prob方法,否则使用attr方法
prop方法
代码:
<script>
$(function(){
//全选/全部选
$("#selectAll").change(function(){
$("input[name=items]").prop("checked",this.checked)
})
$("#checkedAll").click(function(){
$("input[name=items]").prop("checked",true)
})
$("#checkedNo").click(function(){
$("input[name=items]").prop("checked",false)
})
//取反
$("#checkRev").click(function(){
$("input[name=items]").each(function(){
this.checked = !this.checked
})
})
$("#checkValue").click(function(){
var str="";
$("input[name=items]").each(function(){
if(this.checked){
str += $(this).val()
}
})
alert(str)
})
})
</script>