zoukankan      html  css  js  c++  java
  • 分享一个双击后编辑并AJAX提交保存的脚本

        <script type="text/javascript">
            jQuery(document).ready(function () {
                jQuery(".wordsupdate").dblclick(function () {
                    id = jQuery(this).attr('id');
                    text = jQuery(this).text();
                    if (text) {
                        jQuery(this).html("<textarea style='200px;height:50px;' name=" + id + " >" + text + "</textarea>");
                        jQuery(".wordsupdate > textarea").focus().blur(function () {
                            jQuery.ajax({
                                type: "POST",
                                url: "/Home/Update",
                                data: "ID=" + id + "&Str=" + jQuery("#" + id + " > textarea").val(),
                                success: function (msg) {
                                    jQuery("#" + id).html(jQuery("#" + id + " > textarea").val());
                                },
                                error: function (msg) {jQuery("#" + id).text(msg);}
                            });
                        })
                    }
                })
            })  
        </script>
  • 相关阅读:
    CSS 之 伪类及伪元素
    php使用strlen()判断中文汉字字符串长度
    代码评审
    Windows下获取本机IP地址方法介绍
    c++ windows 获取mac地址
    Windows编译安装OpenSSL
    visio studio2008 删除最近的项目
    Windows中杀死占用某个端口的进程
    apache日志文件太大的问题
    text段,data段,bss段,堆和栈
  • 原文地址:https://www.cnblogs.com/bober/p/2345076.html
Copyright © 2011-2022 走看看