父页面
//创建窗口
function showEditDialog(obj) {
var objNum = arguments.length;
var d = parent.dialog({
id: "addorder",
width: '100%',
height: '500px',
title: '修改日期',
url: "order.aspx"
}).showModal();
d.button([{ value: '确定'}]);
if (objNum == 1) {
d.data = obj; // 给窗体传入对象
}
}
<asp:Label ID="lbluserid" runat="server" Text="" name="lbluserid" ></asp:Label>
<asp:Label ID="lbl_afterdate" runat="server" Text="" class="sp_afterdate"></asp:Label>
<input type="text" id="txt_afterdate" class="txt_afterdate" runat=server>
弹出的子页面order.aspx
//获得父窗体传值
var addorder = top.dialog.get("addorder"); //父页面中dialog的id设置为addorder
//如果是第一次访问本页面,则api为空,由父窗体打开本页面,api不为空
if ($(addorder.data).length > 0) {
userid = $("#lbluserid", window.parent.document).text(); //获得用户id
}
function Edit(date, time) {
$(".sp_afterdate", window.parent.document).text(date + " " + time);
$(".txt_afterdate", window.parent.document).val(date + " " + time);
var d = parent.dialog({
width: '250px',
height: '120px',
title: '修改日期',
content: "已经修改,提交后保存"
}).show();
d.button([{ value: '确定'}])
return false;
}
//这里保存成功后不能关闭子窗口,求各路大神补充完整
标签:窗口,parent,addorder,dialog,var,id,传值,页面 From: https://www.cnblogs.com/qigege/p/17224627.html