วันเสาร์ที่ 15 มกราคม พ.ศ. 2554

delete record confirmation by num


<!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=tis-620" />
<title>delete record confirmation by num</title>
<style type="text/css">
* {margin:0;padding:0}
tr.selected {background-color:#ccc;}
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script>
//<![CDATA[
$(function(){
$('.del').click(function(e){
e.preventDefault();
$(this).parents('.tr').addClass('selected');
if (confirm('delete?')){
//ajax delete
//var id = $(this).attr('rel');
//$.post('delete-action.php?id='+id);
$(this).parents('.tr').remove();
}else{
$(this).parents('.tr').removeClass('selected');
}
});
});
//]]>
</script>
</head>

<body>

<table border="1">
<tbody id="tb">
<tr class="tr"><td>###### 1</td><td><a href="#" class="del" rel="1">del</a></td></tr>
<tr class="tr"><td>###### 2</td><td><a href="#" class="del" rel="2">del</a></td></tr>
</tbody>
</table>

</body>
</html>

ไม่มีความคิดเห็น:

แสดงความคิดเห็น