jquery表格可编辑修改表格里面的值,点击td变input无刷新更新表格

通过jQuery实现可以修改的表格 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script src="../js/jquery-1.11.3.js"></script> <style> *{ 阅读详情

td点击后变为input可以输入,更新数据,无刷新更新


 

XML/HTML Code
  1. <table border="0" cellpadding="0" cellspacing="0">    
  2.             
  3.             <tr>    
  4.                 <th><a href="http://www.freejs.net">freejs.net演示</a></td>    
  5.                 <th scope="col">列1</th>    
  6.                 <th scope="col">第二列</th>    
  7.                 <th scope="col">其他</th>    
  8.             </tr>    
  9.         <tbody>    
  10. <?php    
  11. require "conn.php";    
  12.    
  13.     
  14. $sql="select * from `add_delete_record` where id>0";    
  15. $rs=mysql_query($sql);    
  16. if ($row = mysql_fetch_array($rs))    
  17. {    
  18.     do {    
  19. ?>    
  20.     
  21.   <tr>    
  22.                 <th><?php echo $row['id']?></th>    
  23.                 <td class="content"><?php echo $row['content']?></td>    
  24.                 <td class="text"><?php echo $row['text']?></td>    
  25.                 <td class="position"><?php echo $row['position']?></td>    
  26.             </tr>    
  27. </Tr>    
  28. <?php     
  29.     }    
  30.         
  31.     while ($row = mysql_fetch_array($rs));    
  32. }?>    
  33.                
  34.         </tbody>    
  35.     </table>        
  36. 注意:5个字符以上数据库不能添加    
  37.     
  38. <script type="text/javascript" src="../../js/jquery-1.9.1.min.js"></script>    
  39. <script type="text/javascript">    
  40. $(function(){        
  41.     
  42.     $('table td').click(function(){    
  43.         if(!$(this).is('.input')){    
  44.             $(this).addClass('input').html('<input type="text" value="'+ $(this).text() +'" />').find('input').focus().blur(function(){    
  45.                 var thisid = $(this).parent().siblings("th:eq(0)").text();    
  46.                 var thisvalue=$(this).val();    
  47.                 var thisclass = $(this).parent().attr("class");      
  48.                  
  49.                 $.ajax({    
  50.                   type: 'POST',    
  51.                   url: 'update.php',    
  52.                   data: "thisid="+thisid+"&thisclass="+thisclass+"&thisvalue="+thisvalue    
  53.                 });    
  54.                 $(this).parent().removeClass('input').html($(this).val() || 0);    
  55.             });                        
  56.         }    
  57.     }).hover(function(){    
  58.         $(this).addClass('hover');    
  59.     },function(){    
  60.         $(this).removeClass('hover');    
  61.     });    
  62.     
  63. });    
  64. </script>    

 update.php

PHP Code
  1. <?php  
  2. require "conn.php";  
  3. $id = trim($_REQUEST['thisid']);  
  4. $thisclass = trim($_REQUEST['thisclass']);  
  5. $thisvalue= trim($_REQUEST['thisvalue']);  
  6. if (substr_count($thisclass," ")>0){  
  7. $thisclass=str_replace(" ","",$thisclass);  
  8. }  
  9. if (substr_count($thisclass,"input")>0){  
  10. $thisclass=str_replace("input","",$thisclass);  
  11. }  
  12. $update_sql = "update add_delete_record set $thisclass='$thisvalue' where id='$id'";  
  13. $result = mysql_query($update_sql);  
  14. ?>   

 


原文地址: http://www.freejs.net/article_biaodan_34.html
用jQuery修改表格单元格的值 要使用jQuery来修改表格单元格的值,你可以通过选择器选择目标单元格,然后使用jQuery的方法来修改它的内容。下面是一些示例代码,演示如何使用jQuery来操作表格单元格的值。首先,确保在HTML文档中引入了jQuery库。你可以从jQuery官方网站上下载最新版本的jQuery,并将其包含在你的HTML文件中。在HTML文件的标签中添加以下代码: 阅读详情

相关推荐

银河麒麟服务器操作系统V10SP3 U盘安装中“基础软件仓库错误”的排查与修复指南

本文针对在无网络环境下使用U盘安装银河麒麟服务器操作系统V10SP3时,遇到的“基础软件仓库错误”问题,提供了详细的排查与修复指南。核心解决方案是通过进入救援模式,使用lsblk命令确定U盘实际设备路径,并在系统引导时手动添加inst.repo内核参数来指定安装源,从而绕过安装程序的自动探测故障,确保安装流程顺利进行。

ik67890123的博客 1193

jquery 点击表格变为input可以修改无刷新更新数据

之前已经发了2篇类似的文章《点击变td为input更新》和《jquery表格可编辑修改表格里面的值,点击td变input无刷新更新表格》 这篇功能是一样的,不过实用性可能比不上前面的文章     演示   PHP Code &lt;table&gt;   &lt;Tr&gt;&lt;Td colspan="2"&gt;如果本例看不到数据请先添加一条记录,点击&l...

freejs 508

别再手动抓波形了!用Synopsys AXI VIP的Port Monitor自动收集事务数据(附完整连接Scoreboard代码)

当标准Port Monitor无法满足需求时,Synopsys提供的callback机制就像一套精密的手术工具,允许你深入VIP内部进行定制化改造。创建自定义监控点的四步法继承基类// 其他自定义字段...endclass重写目标phase方法// 克隆事务并发送到自定义端口在env中注册callbackcustom_cb);连接自定义端口到分析组件经典应用场景地址phase特定检查数据beat级监控自定义性能统计异常注入检测。

weixin_28716181的博客 397

创建表格

题目 完成一个可编辑的表格 代码 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> *{ padding: 0; margin: 0; } .tab{

Liu_Ma的博客 422

从CMT2300A实战出发:Sub1G射频匹配电路设计要点与315MHz应用详解

本文从CMT2300A芯片实战出发,详细解析Sub1G射频匹配电路设计要点,特别针对315MHz应用场景。内容涵盖频段划分逻辑、调制方式选择、晶体振荡器设计等基础认知,以及315MHz匹配电路物料选型、巴伦网络处理等实战技巧,并分享PCB布局防干扰设计和实测验证方法,助力开发者优化射频通信性能。

weixin_29238147的博客 162

Chromatix 7实战:从零开始调优ISP模块的完整流程(附常见报错解决方案)

本文提供了高通平台Camera调试工具Chromatix 7的完整实战指南。详细阐述了从环境准备、项目初始化、基础校正(如LSC、BPC)到核心ISP管线(Demosaic、CCM、HDR)及后处理(CAC、ANR)的调优全流程,并附带了常见报错(如“未初始化实例”)的解决方案,旨在帮助工程师建立系统性的调试方法论。

weixin_29290863的博客 622

jquery实现表格的即时编辑(增,删,改,查)

演示地址:https://wow.techbrood.com/fiddle/54101?vm=full

得意小门生的博客 820

2、微软 Power Automate 入门指南

本文是一篇关于微软 Power Automate 的入门指南,详细介绍了 Power Automate 的基本概念、相关术语、登录方式以及如何创建一个简单的自动化流。文章还探讨了 Power Automate 在业务流程中的应用场景和优势,并展望了其高级功能和未来发展。适合希望快速入门 Power Automate 并提升业务自动化效率的读者。

corn8的博客 441

jquery——双击编辑异步更新(双击内容变input框可编辑,失去焦点后修改的数据异步提交)

html页面     Insert title here                                              标题         时间         地点                                 第一个         2012         上海

danson_yang的专栏 3705

华为OD机考 新系统真题 【区分奇偶的数组排序】

华为OD机试 新系统真题【区分奇偶的数组排序】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD机试真题【区分奇偶的数组排序】多语言题解。

qq_45776114的博客 507

4位无符号比较器设计

4位无符号比较器设计

好好学习,天天向上 7891

点击变td为input更新

数据库很简单表add_delete_record字段text和id演示 index.php PHP Code    "Content-Type" content="text/html; charset=utf-8">  jquery 点击表格变为input可以修改,鼠标点击其他任意位置无刷新更新数据  "text/javascript" src="../../js/jquery-1.3.2.min

管子(zero)的杂乱空间 1928

PCB仿真软件:Altium Designer_(18).PCB设计中的热管理

在PCB设计中,热管理是一个至关重要的环节。随着电子设备的集成度越来越高,功耗和发热量也随之增加,不合理的热设计可能导致电路板过热,从而影响电路的性能和可靠性。热管理不仅能够提高电路板的使用寿命,还能确保电路在各种环境条件下的稳定工作。本节将详细介绍如何在Altium Designer中进行有效的热管理,包括热分析、热设计和热仿真等关键步骤。

kkchenjj的博客 1985

【JQuery 】表格td双击可编辑

JQuery 实现表格td双击可编辑

在红尘中争渡 1065

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

Jquery php 点击td变成input,修改后失去焦点发送数据

html部分 Js部分 /**//* * 说明:用Jquery的方法,无刷新页面,编辑表格 */ $(function() { //给页面中有bigclassname类的标签上加上click函数 $(".bigclassname").click(function() { var objTD = $(this); //先将老的类别名称保存起来,并用trim方法去掉左右多余的空格 var old

管子(zero)的杂乱空间 2080

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

jquery 获取table tr td值

jquery代码(jquery 获取table tr td值//完成修改功能 ) var td=td=td=(td).parents(‘tr’).children(‘td’); KaTeX parse error: Expected 'EOF', got '#' at position 3: ("#̲seshu").val(td.eq(0).find(‘input’).val()); KaTeX parse error: Expected 'EOF', got '#' at position 3: ("#̲

weixin_43930956的博客 1279

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

[转]jquery 点击表格变为input可以修改无刷新更新数据

原文地址:http://www.freejs.net/article_biaodan_43.html 之前已经发了2篇类似的文章《点击变td为input更新》和《jquery表格可编辑修改表格里面的值,点击td变input无刷新更新表格》 这篇功能是一样的,不过实用性可能比不上前面的文章 PHP Code &lt;table&gt;   &lt;Tr&gt;&lt;T...

weixin_33872566的博客 172

双击 表格 td 变成 可以编辑的input框 失去焦点提交

$("#table").on("dblclick","td",function(){ var td = $(this); var url=$("form").attr("action"); // 根据表格文本创建文本框 并加入表表中--文本框的样式自己调整 var text = td.text(); var txt = $("").val(text);

qq_27970999的博客 4562

php< td>,Jquery php 点击td变成input,修改后失去焦点发送数据

html部分Js部分/**//** 说明:用Jquery的方法,无刷新页面,编辑表格*/$(function() {//给页面中有bigclassname类的标签上加上click函数$(".bigclassname").click(function() {var objTD = $(this);//先将老的类别名称保存起来,并用trim方法去掉左右多余的空格var oldText = $.trim...

weixin_39953740的博客 244

jQuery实现可编辑表格

可编辑表格,这个东西听起来挺高大上,其实用jQuery来实现,了解一下思路,就很简单 1.事实上是编辑td里面的内容,所以给他一个双击事件 2.双击完了这个td将其变为一个input,里面的值还保留着 3.最后就是失去焦点的时候还原,就欧克了 &lt;%@ page language="java" contentType="text/html; charset=UTF-8" pageEn...

BarryLee的博客 6291
上一篇: jQuery+Ajax+PHP+Mysql实现分页显示数据
下一篇: js tab选项卡 mootools tab选项卡
piperzero
博客等级 码龄21年 1377粉丝 504原创
评论 3
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值