ayha1999
asked on
Error: 'opener.document' is null or not an objectQuestion:
The above error occurs when I click a hyperlink on a child window. How can I solve the problem?
<input onclick="Javascript:window .showModal Dialog('Cu stomers.as px', '', 'dialogWidth:300px;dialogH ieight:300 px;status= no;scrollb ars=no;'); " return false" type="button" value="Pick" />
<a href="#" onclick="opener.document.f orms[0].tx tCustId.Te xt='<%# Eval("Id") %>';opener.document.forms[ 0].txtName .Text='<%# Eval("Name") %>'; window.close(); return false"> <%# Eval("Id")%></a>
thanks
ayha
<input onclick="Javascript:window
<a href="#" onclick="opener.document.f
thanks
ayha
ASKER
could u please give me a sample using "returnValue"?
thanks
thanks
showModalDialog is not a window the same way window.open is. So, yeah, window.opener is null.
Check out this page:
http://msdn2.microsoft.com/en-us/library/ms536759.aspx
Use 'dialogArguments' to move do updates and such.
Check out this page:
http://msdn2.microsoft.com/en-us/library/ms536759.aspx
Use 'dialogArguments' to move do updates and such.
Code for parent page
code for child page called from a save button or close button
<script type="text/javascript">
function openModalWindow(url, height, width) {
var features = 'dialogWidth:' + width + ';dialogHeight:' + height + ';status:no;scrollbars:no;'
var rVal = window.showModalDialog(url, "", features);
if (rVal != null)
{
document.getElementById("mycontrolId1").Value = rVal[0];
document.getElementById("mycontrolId2").Value = rVal[1];
}
}
</script>
code for child page called from a save button or close button
<script type="text/javascript">
function closeWindow()
{
var arrReturnVals = new Array(document.getElementById(ctrl1).Value, document.getElelmentById(ctrl2).Value);
window.returnValue = arrReturnVals;
window.close();
}
</script>
ASKER
could you please post the complete script on how to use it on button click and hyperlink?
thanks
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks
You could pass back some comma seperated values back or something like that :
Otherwise you would have to go back to using window.open