您现在的位置是:网站首页> 编程资料编程资料

点击按钮文字变成input框,点击保存变成文字的实现代码限制html文本框input只能输入数字和小数点input checkbox 扩大点击范围的实现方法关于input的file 控件及美化浅谈html中input只读属性readonly和disable的区别快速解决input[type=file]打开时慢、卡顿的问题

2023-10-09 445人已围观

简介 下面小编就为大家带来一篇点击按钮文字变成input框,点击保存变成文字的实现代码。小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

点击按钮文字变成input框,点击保存变成文字的实现代码

XML/HTML Code复制内容到剪贴板
  1. >  
  2. <html lang="en">  
  3. <head>  
  4.   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  5.   <meta charset="utf-8">  
  6.   <title>点击按钮文字变成input框,点击保存变成文字title>  
  7.   <style type="text/css">  
  8.   table{ text-align: center; font-size: 14px;}   
  9.   table>thead>tr>th{ font-weight: normal;}   
  10.   .text-right{ padding-right:73px; text-align: right;}   
  11.   .text{ width: 50px; height: 30px; border: 1px solid #ddd; text-align: center;}   
  12.   style>  
  13.   <script type="text/javascript" src="js/jquery.min.js">script>  
  14. head>  
  15.   
  16. <body>  
  17.   <table>  
  18.     <thead>  
  19.       <tr>  
  20.         <th width="400">品名th>  
  21.         <th width="200">件数th>  
  22.       tr>  
  23.     thead>  
  24.     <tbody>  
  25.       <tr height="50">  
  26.         <td>iPhone6std>  
  27.         <td class="edit">2td>  
  28.       tr>  
  29.       <tr height="50">  
  30.         <td>小米5td>  
  31.         <td class="edit">5td>  
  32.       tr>  
  33.     tbody>  
  34.     <tfoot>  
  35.       <tr>  
  36.         <td colspan="2" class="text-right">  
  37.           <button type="button" class="btn" onclick="change(this)">修改button>  
  38.         td>  
  39.       tr>  
  40.     tfoot>  
  41.   table>  
  42.   
  43. <script type="text/javascript">  
  44. function change(obj){   
  45.   var xg=$(obj).html();   
  46.   if(xg=='修改'){   
  47.     $('.edit').each(function(){   
  48.       var old=$(this).html();   
  49.       $(this).html("<input

-六神源码网