如何用jquery 创建一个dialog dialog中有一个textbox可以输入和修改数据

direren 2012-02-15 02:20:14
我可以创建一个dialog,想要达到的效果是,弹出窗口中有一个文本框,可以修改数据,另外有两个按钮,保存修改内容,或者取消。现在有按钮,但是不知道怎么在其中加一个文本框,文本框应该显示已有的数据,而且用户可以修改。下面是javascript 代码,和asp.net 代码。请知道的人帮忙说一下怎么在jquery UI dialog中加入一个open text box, 最好能给出例子代码,谢谢。



<script type="text/javascript">
$(document).ready(function () {
$("#editDescriptionPopup").click(editDescription);
});

function editDescription(description) {
//alert("Edit Description");

$("#editDescriptionPopup").dialog({
title: "Edit Invoice Description",
autoOpen: true,
width: 400,
modal: true,
resizable: false,

close: function (event, ui) {
$("#editDescriptionPopup").remove();
},

open: function (event, ui) {
var Description = "Jquery Description";
var url = "/Invoice/UpdateDescriptionPopup";
var data = { id: 12, description: Description };

$.ajax({
url: url,
data: JSON.stringify(data),
success: function (result) {

},

error: displayAjaxError
});
},
buttons: {
"Save": function () {
var Description = "Jquery Description";
var url = "/Docket/Invoice/UpdateDescriptionPopup";
var data = { id: 12, description: Description };

$.ajax({
url: url,
data: JSON.stringify(data),
success: function () {
$("#editDescriptionPopup").append(data);
},
error: displayAjaxError
})

$("#editDescriptionPopup").dialog("close");
},

"Cancel": function () { $(this).dialog('close') }
}
});
}
</script>


<th class="detailsHeader">Invoice Description (<a href="#" id="editDescriptionPopup">Edit</a>)</th>
<td colspan="1" class="detailsValue">
<%= Html.Raw(Model.Invoice.Description) %>
</td>
...全文
539 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
JonyBang 2013-12-20
  • 打赏
  • 举报
回复
终于找到源码了,学习了!
桃园闲人 2012-02-15
  • 打赏
  • 举报
回复
JQuery没有这样现成的组件,你需要自己封装一个层(DIV)实现数据编辑,然后用JQuery将层在需要的时候以对话框的形式弹出即可。
三石-gary 2012-02-15
  • 打赏
  • 举报
回复
http://hi.baidu.com/li_mingzhu/blog/item/1279308d319a0ea60e2444fd.html
配合jQuery搭载的快递服务申请系统的原型界面,目录结构: │ apply.html │ apply_examine.html │ Audit_list.html │ bill_list.html │ detail.html │ group_list.html │ Index.html │ list.html │ replace_apply.html │ Replace_list.html │ service_list.html │ user_list.html │ ├─css │ │ apply.css │ │ apply_examine.css │ │ demo.css │ │ detail.css │ │ index.css │ │ replace_apply.css │ │ │ └─themes │ │ color.css │ │ icon.css │ │ │ ├─black │ │ │ accordion.css │ │ │ calendar.css │ │ │ combo.css │ │ │ combobox.css │ │ │ datagrid.css │ │ │ datebox.css │ │ │ dialog.css │ │ │ easyui.css │ │ │ filebox.css │ │ │ layout.css │ │ │ linkbutton.css │ │ │ menu.css │ │ │ menubutton.css │ │ │ messager.css │ │ │ numberbox.css │ │ │ pagination.css │ │ │ panel.css │ │ │ progressbar.css │ │ │ propertygrid.css │ │ │ searchbox.css │ │ │ slider.css │ │ │ spinner.css │ │ │ splitbutton.css │ │ │ tabs.css │ │ │ textbox.css │ │ │ tooltip.css │ │ │ tree.css │ │ │ validatebox.css │ │ │ window.css │ │ │ │ │ └─images │ │ accordion_arrows.png │ │ blank.gif │ │ calendar_arrows.png │ │ combo_arrow.png │ │ datagrid_icons.png │ │ datebox_arrow.png │ │ layout_arrows.png │ │ linkbutton_bg.png │ │ loading.gif │ │ menu_arrows.png │ │ messager_icons.png │ │ pagination_icons.png │ │ panel_tools.png │ │ searchbox_button.png │ │ slider_handle.png │ │ spinner_arrows.png │ │ tabs_icons.png │ │ tree_icons.png │ │ validatebox_warning.png │ │ │ ├─bootstrap │ │ │ accordion.css │ │ │ calendar.css │ │ │ combo.c

87,918

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧