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>
  • 相关阅读:
    MyEclipse的优化
    关于学习Hadoop中未总结的资料
    OSChina 的 Tomcat 配置 server.xml
    Linux 定时任务 Crontab命令 详解
    常用Linux命令收集
    SQL练习 高级子查询
    JAVA设计模式中的单例模式
    Linux课程笔记 Rsync数据同步服务
    Linux课程笔记 SSH介绍
    Linux课程笔记 Raid技术介绍
  • 原文地址:https://www.cnblogs.com/bober/p/2345076.html
Copyright © 2011-2022 走看看