现有表格中的一行的代码如下所示:
效果可以看下具体51搜索展示http://www.51bt.cc,结合xunsearch全文检索技术,可以达到毫秒级的数据搜索
2 公司介绍 内部栏目 2
要实现鼠标单击修改内容思路如下:
1、点击栏目排序栏目中的数字,获取同一行的第一列中的内容,即栏目id
2、隐藏栏目排序中的数字
3、在栏目排序列中插入input框,并在input框中显示栏目排序中的内容,并设置为焦点
4、修改input中的内容,失去焦点的时候提交数据,用ajax向服务器传递数据 方法为post方法
5、提交数据的时候,友好提示修改中。。。 或者等待图片
6、返回成功信息 ,重新显示修改后的内容 去掉input框
实现这一功能的jquery核心代码如下:
$('.listorder').click(function(e){var catid = $(this).parent().siblings(td:eq(0)).text();//获取同一行上 第一列中的id值var listorder_now_text = $(this).text();//获取listorder中的内容 先保存起来$(this).text();//设置内容为空var list_form = '' ;$(this).parent().append(list_form); //插入 input框$(.listorder_input).focus();//自定义一个div 提示修改中var loading = '
';$(this).parent().append(loading);$('#loading').css({color : red ,display : none})//定义ajax的全局事件$(this).ajaxstart(function(){$('#loading').show();})$(this).ajaxstop(function(){$('#loading').remove();})$(.listorder_input).blur(function(){var thislist = $(this).siblings(); //取得同级的标签 即 修改后需要显示的 listorder$.post(ajax.php,{action : mod_listorder,catid : catid ,listorder : $(this).attr(value)} , function(data, textstatus){$(thislist).text(data);});//end .post$(this).remove();})//end function blur})// end
function clickajax.php中内容就简单了,这里只做处理做演示用,并没有向服务器提交数据,代码如下:
sleep(1);//延时运行1秒,查看效果用,实际代码中不需要echo $_post['listorder'];