01.
<script type=
"text/javascript"
src=
"jquery-1.4.2.min.js"
></script>
02.
<script type=
"text/javascript"
>
03.
$(document).ready(
function
(){
04.
05.
$(
':checkbox[name^=cb]'
).not(
':checked'
).each(
function
(index, ele){
06.
$(ele).next(
'img'
).css(
'opacity'
,
'0.45'
);
07.
});
08.
09.
10.
$(
'img[id^=rbin]'
).click(
function
(){
11.
var
cb = $(this).prev(
':checkbox'
);
12.
13.
if
(cb.is(
':checked'
))
14.
{
15.
cb.attr(
'checked'
,
''
);
16.
$(this).css(
'opacity'
,
'0.45'
);
17.
}
18.
else
19.
{
20.
cb.attr(
'checked'
,
'checked'
);
21.
$(this).css(
'opacity'
,
'1'
);
22.
}
23.
});
24.
});
25.
</script>
26.
27.
<?php
for
(
$i
=0;
$i
< 10;
$i
++): ?>
28.
<?php
$is_checked
= (
$i
% 2) ?
' checked="checked"'
:
''
;?>
29.
<span>
30.
<input type=
"checkbox"
name=
"cb[]"
value=
"<?php echo $i;?>"
<?php
echo
$is_checked
;?> style=
"display:none"
/>
31.
<img src=
"78.png"
id=
"rbin<?php echo $i;?>"
width=
"20"
height=
"20"
/>
32.
</span>
33.
<?php
endfor
;?>