我想从一个子页面向我的父页面传递一个值:
父页面脚本:
<script type="text/javascript">
var popup;
function SelectName() {
popup = window.open("SelDestination.aspx", "Select", "width=500,height=300");
popup.focus();
return false;
}
</script>在子页面上:
<asp:Button ID="btnSelect" runat="server" CssClass="button" Text="انتخاب" OnClientClick="SetName();" />子页面脚本为:
<script type="text/javascript">
function SetName() {
if (window.opener != null && !window.opener.closed) {
var ddlName = window.opener.document.getElementById("txtDes");
//var e = document.getElementById("<%=ddlOffice.ClientID %>");
ddlName.value = "Hi";
}
window.close();
}
但是它不能正常工作(我有一个运行时错误: ddlname is null or undefined)!
有什么办法解决这个问题吗?
发布于 2014-11-17 20:31:01
创建一个javascript文件,并在head中执行以下操作:
<script src="path/to/ye/js"></script>记住在两个站点上都要这样做。然后将这个变量添加到javascript文件中。
https://stackoverflow.com/questions/26972553
复制相似问题