zoukankan      html  css  js  c++  java
  • 双击文本框,可编辑状态,当鼠标移走后

    // JavaScript Document

    $(function() { 
    //获取class为caname的元素 
    $(".caname").click(function() { 
        var td = $(this); 
        var txt = td.text(); 
        var input = $("<input type='text'value='" + txt + "' style='23px;'/>"); 
        td.html(input); 
        input.click(function() { return false; }); 
    //获取焦点 
        input.trigger("focus"); 
    //文本框失去焦点后提交内容,重新变为文本 
        input.blur(function() { 
        var newtxt = $(this).val(); 
    //判断文本有没有修改 
      if (newtxt != txt) { 
        td.html(newtxt);
        var wid = $.trim(td.prev().text());
        var database=$("#database").val();
        $.ajax({
           type:"POST",
           
           url:"/admin.php/Index/modifypx",
           
           data:{id:wid,paixu:newtxt,database:database},
           
           dataType:"json",
           
           success:function(data){
              if(data ==1){
                        $.gritter.add({
                            // (string | mandatory) the heading of the notification
                            title: '修改排序成功',
                            // (string | mandatory) the text inside the notification
                            text: ' ',
                            time: 1000
                        });
                        window.location.reload();
                 }else{
                        $.gritter.add({
                            // (string | mandatory) the heading of the notification
                            title: '修改排序失败',
                            // (string | mandatory) the text inside the notification
                            text: ' ',
                            time: 1000
                        });
                 }
           }
        });
        
      } 
      else 
      { 
      td.html(newtxt); 
      } 
      }); 
      });
    }); 




  • 相关阅读:
    Windows下PHP开启mcrypt扩展和SSL(OpenSSL)扩展支持
    MyBatis 学习笔记
    试用百度云计算平台
    TCP三次握手及四次挥手详细图解
    Java开发中的23种设计模式详解
    Extjs4.1.0_从入门到精通
    SQLite3命令操作大全
    带你了解 HBase 数据模型和 HBase 架构
    让数据库无惧灾难,华为云GaussDB同城双集群高可用方案正式发布!
    论文阅读丨神经清洁: 神经网络中的后门攻击识别与缓解
  • 原文地址:https://www.cnblogs.com/muxiaoye/p/56c920f76b0ce6a7a0b0c5907d43d610.html
Copyright © 2011-2022 走看看