I use this code for add string to element of parent windows form popup :
window.opener.document.getElementById('myid').innerHTML += 'string';
Now I want to add string to element of iframe form popup.Both of iframe and parent is in the same domain. I try this code but not work:
parent.myframename.window.opener.document.getElementById('iframeelementid').innerHTML += 'string';
What is wrong? Is there any way to do this?
Thanks for any help.
* UPDATE *
This is my complete code. Main page:
<html>
<head>
<script>
function myPopup() {
window.open( "pop.htm", "myWindow", "status = 1, height = 180px, width = 330px)
}
</script>
</head>
<body>
<textarea id="input"><iframe src="frame.html" name="myframe"></iframe> </textarea>
<a href="" onclick="myPopup()">Popup</a>
</body>
</html>
and pop.htm:
<html>
<head>
<script>
function insert() {
parent.myframe.window.opener.document.getElementById('inframe').innerHTML += 'asasasas';
window.close();
return false;
}
</script>
</head>
<body>
<input type="button" id="insert" onclick="insert()" value="insert" />
</body>
</html>
and iframe.html:
<html>
<head>
</head>
<body>
<span id="inframe"></span>
</body>
</html>
You can Use
window.openerLook here