Debt Consolidation - Submit articles - Debt Consolidation - Debt Consolidation - vBulletin

PDA

View Full Version : how to access parent window controls from child window


musman007
May 19th 2008, 4:47 pm
hey y'all,

I am trying to access a control which is a hidden field. from child window. Which I opened with the helpf of ShowModalDialog().
I have tried this on child window.

window.opener.document.forms(0).getElementById("Literal1").value = document.forms(0).getElementById("Literal2").value.

But i am getting an error. window.opener.docoment.forms(0).getElementById(..) is not an object or null.

Please advise how can I access the value of parent control from child window.


Thanks in advance.

hotmarket
May 19th 2008, 10:37 pm
you can't use window.operner,but you can use below ideas:
<script type="text/javascript">
function openWin(){
// child windows
var srcFile = "child.html";
// windows features
var winFeatures = "dialogHeight:300px; dialogLeft:200px;";
// The form id as param
var obj = getForm;
// open windows
window.showModalDialog(srcFile, obj, winFeatures);
}
</script>
<form id="getForm">
Get value:
<input type="text" id="getValue" readOnly>
</form>
<input type="button" value="open" onClick="openWin()">
//////
child html
/////
<script type="text/javascript">
function send(){
// Get param obj
var obj = window.dialogArguments;
// set value
obj.getValue.value = 'from Child';
}
</script>
<a href="#" onclick="send();">Send</a>