- <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='width: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>
- //该片段来自于http://www.codesnippet.cn/detail/191120137307.html
来源: http://www.codesnippet.cn/detail/191120137307.html