Html简单demo_html列表中进行编辑操作
2013-06-28 14:31
274 查看
html列表中进行编辑操作
<div class="_sort_box" style="float: left;"><?php echo $vo['remark'];?></div>
<div class="_sort_input_box" style="display:none; float: left;">
<input type="text" style="width:60px;" value="<?php echo $vo['remark'];?>" />
</div>
<div class="_edit_box" style="float: right;margin-right: 15px;">
<a class="_edit" href="javascript:void(0);" title="编辑客户备注">编辑</a>
</div>
<div class="_update_box" style="display:none;float: right;margin-right: 15px;">
<input name="plugin_id" type="hidden" value="<?php echo $vo['user']?>" />
<a class="_save" href="javascript:void(0);">保存</a>
<a class="_cancel" href="javascript:void(0);">取消</a>
</div>
//编辑
$('._edit').click(function(){
var tr = $(this).parents('tr');
tr.find('._sort_box').hide();
tr.find('._sort_input_box').show().find('input').val(tr.find('._sort_box').html());;
tr.find('._edit_box').hide();
tr.find('._update_box').show();
});
//保存
$('._save').click(function(){
if(window.flagReq == true)return;
var plugin_id = $(this).prev('input[name=plugin_id]').val();
var tr = $(this).parents('tr');
var sort = tr.find('._sort_input_box').find('input').val();
var url = "<?php echo url('User', 'updateRemark');?>";
window.flagReq = true;
$.post(url, {openId:plugin_id,remark:sort}, function(result) {
result = eval('('+result+')');
jsAlert(result.msg,function(){
if(result.error == 0){
tr.find('._sort_box').show().html(sort);
tr.find('._sort_input_box').hide();
tr.find('._edit_box').show();
tr.find('._update_box').hide();
}
window.flagReq = false;
});
});
});
//取消
$('._cancel').click(function(){
var tr = $(this).parents('tr');
tr.find('._sort_box').show();
tr.find('._sort_input_box').hide()
tr.find('._edit_box').show();
tr.find('._update_box').hide();
});
<div class="_sort_box" style="float: left;"><?php echo $vo['remark'];?></div>
<div class="_sort_input_box" style="display:none; float: left;">
<input type="text" style="width:60px;" value="<?php echo $vo['remark'];?>" />
</div>
<div class="_edit_box" style="float: right;margin-right: 15px;">
<a class="_edit" href="javascript:void(0);" title="编辑客户备注">编辑</a>
</div>
<div class="_update_box" style="display:none;float: right;margin-right: 15px;">
<input name="plugin_id" type="hidden" value="<?php echo $vo['user']?>" />
<a class="_save" href="javascript:void(0);">保存</a>
<a class="_cancel" href="javascript:void(0);">取消</a>
</div>
//编辑
$('._edit').click(function(){
var tr = $(this).parents('tr');
tr.find('._sort_box').hide();
tr.find('._sort_input_box').show().find('input').val(tr.find('._sort_box').html());;
tr.find('._edit_box').hide();
tr.find('._update_box').show();
});
//保存
$('._save').click(function(){
if(window.flagReq == true)return;
var plugin_id = $(this).prev('input[name=plugin_id]').val();
var tr = $(this).parents('tr');
var sort = tr.find('._sort_input_box').find('input').val();
var url = "<?php echo url('User', 'updateRemark');?>";
window.flagReq = true;
$.post(url, {openId:plugin_id,remark:sort}, function(result) {
result = eval('('+result+')');
jsAlert(result.msg,function(){
if(result.error == 0){
tr.find('._sort_box').show().html(sort);
tr.find('._sort_input_box').hide();
tr.find('._edit_box').show();
tr.find('._update_box').hide();
}
window.flagReq = false;
});
});
});
//取消
$('._cancel').click(function(){
var tr = $(this).parents('tr');
tr.find('._sort_box').show();
tr.find('._sort_input_box').hide()
tr.find('._edit_box').show();
tr.find('._update_box').hide();
});
相关文章推荐
- 通过简单BUG跟踪Demo阐述用户控件对列表的操作
- android 使用 websocket 进行长链接的一个简单的 demo,可以用来收发消息或别的操作,里面用到了 autobahn 的 jar 包
- 简单的GreendaoDemo操作进行增删该查
- js中对arry数组的各种操作小结 瀑布流AJAX无刷新加载数据列表--当页面滚动到Id时再继续加载数据 web前端url传递值 js加密解密 HTML中让表单input等文本框为只读不可编辑的方法 js监听用户的键盘敲击事件,兼容各大主流浏览器 HTML特殊字符
- [MOSS开发]:通过简单BUG跟踪Demo阐述用户控件对列表的操作
- 对XML进行简单的查询,插入,删除,编辑操作
- php操作mysql获取html标签<select>下拉列表数据
- 使用BeanUtils进行一些简单的操作
- Tkinter中关于如何让用户无法编辑Text,又可进行插入、删除操作
- Vue.js Demo 数据及其列表操作
- Python基础二之简单列表操作补充
- 简单sql查询接口(需要在文件中指定conn才能进行sql语句操作)
- IHTMLDocument2接口的简单操作
- Android(java)学习笔记186:对ListView等列表组件中数据进行增、删、改操作
- GridView下进行编辑操作,根据某项指标判断该行是否可以进行编辑.
- Elasticsearch简单使用系列--使用Rest API进行CRUD操作
- html dom与javascript的关系 -我们用JavaScript对网页(HTML)进行的所有操作都是通过DOM进行的
- Android之使用ContentResolver对通信录中的数据进行简单操作
- 使用 jsoup 对 HTML 文档进行解析和操作
- JDBC简单操作Demo