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>
  • 相关阅读:
    强制设置IE浏览器的版本模式
    设置DIV根据内容自动调整高度的三个方法
    VS2010如何调试IIS上的网站
    DataSet和List<T> 泛型之间互相转换 (转载, 作者写的很好)
    List转DataSet
    数据库中单个表数据备份
    第二阶段冲刺(第二天)
    冲刺第二阶段(第一天)
    学习进度条(第十四周)
    学习进度条(第十三周)
  • 原文地址:https://www.cnblogs.com/bober/p/2345076.html
Copyright © 2011-2022 走看看