jquery 一句话实现全选框
<!DOCTYPE Html>
02
<
html
>
03
<
head
>
04
<
script
type
=
"text/javascript"
src
=
"http://code.jquery.com/jquery-1.4.4.min.js"
></
script
>
05
<
script
type
=
"text/javascript"
>
06
function selectAll(checkbox) {
07
$('input[type=checkbox]').attr('checked', $(checkbox).attr('checked'));
08
}
09
</
script
>
10
</
head
>
11
<
body
>
12
<
input
type
=
"checkbox"
onclick
=
"selectAll(this);"
/>全选<
br
/>
13
<
input
type
=
"checkbox"
/><
br
/>
14
<
input
type
=
"checkbox"
/><
br
/>
15
<
input
type
=
"checkbox"
/><
br
/>
16
<
input
type
=
"checkbox"
/><
br
/>
17
<
input
type
=
"checkbox"
/><
br
/>
18
<
input
type
=
"checkbox"
/><
br
/>
19
……
20
</
body
>
21
</
html
>