<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script>
$(function(){
$('.test_class input[type=checkbox]').on('change',function(){
var id = $(this).attr('value');
var check = ($(this).attr('checked')=='checked')?1:0;
if(check==1){
add(id); //add item
}else{
del(id); //del item
}
});
})
function add(id){
$.post('/diy/add',{id:id},function(rs){
});
}
function del(id){
$.post('/diy/del',{id:id},function(rs){
});
}
</script>
</head>
<body>
<div class="test_class">
<input type="checkbox" id="prod_1" value='1'>西瓜
<input type="checkbox" id="prod_1" value='2'>香蕉
<input type="checkbox" id="prod_1" value='3'>苹果
</div>
<tr><!--勾选后,name,size会印在这边--><tr>
</body>
</html>