<!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" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
<script src="{{ asset('js/jquery.js') }}"></script>
</head>
<body>
<center>
<a href="cha">插入数据</a>
<table border="1">
<tr>
<td><input type="checkbox"/></td>
<td>名称</td>
<td>价格</td>
<td>操作</td>
</tr>
<?php foreach($arr as $k=>$v){ ?>
<tr>
<td><input type="checkbox" name="message" value="<?php echo $v['id'] ?>"/></td>
<td><?php echo $v['un'] ?></td>
<td><span class="er" pid="<?php echo $v['id'] ?>"><?php echo $v['price'] ?></span></td>
<td><a href="del?id=<?php echo $v['id'] ?>">删除</a></td>
</tr>
<?php } ?>
</table>
<input type="button" value="批量删除"/>
<table border="1">
<tr>
<td>操作人</td>
<td>操作内容</td>
<td>操作时间</td>
</tr>
<?php foreach($err as $k=>$v){ ?>
<tr>
<td><?php echo $v['ming'] ?></td>
<td><?php echo $v['nei'] ?></td>
<td><?php echo $v['data'] ?></td>
</tr>
<?php } ?>
</table>
</center>
</body>
</html>
<script>
$(function(){
$(function(){
$("input:button").click(function() {
var text = $("input:checkbox[name='message']:checked").map(function(index,elem) {
return $(elem).val();
}).get().join(',');
$.get('dell',{iid:text},function(msg){
if(msg==1){
location.href='show'
}else{
alert('删除失败')
}
})
});
});
$(document).delegate('.er','click',function(){
var desc=$(this).html();
var uid=$(this).attr('pid');
$(this).parent().html("<input type=\"text\" value="+desc+" name='aaa'>");
$("input[name='aaa']").focus();
$("input[name='aaa']").blur(function() {
var qq = $(this).val(); //文本框值
var _aa= $(this).parent();
if(qq==""){
alert('不能为空');
_aa.html("<span class=\"er\" id="+uid+">"+desc+"</span>");
}else {
$.get('dian',{qq:qq,uid:uid},function(msg){
// alert(msg)
if (msg == 1) {
_aa.html("<span class=\"er\" pid=" + uid + ">" + qq + "</span>");
} else {
location.href='show';
}
})
}
})
})
})
</script>
jquery即点即改 批量删除
最新推荐文章于 2021-04-01 20:21:40 发布