View Single Post
  #1 (permalink)  
Old April 1st, 2010, 10:01 AM
abhihello123 abhihello123 is offline
Registered User
 
Join Date: Apr 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Angry can any1 solve window.open() and window.opener issues

I'm doing a lil experiment on window.open to achieve certain result. Its something like when I open exp.htm and click on the link an existing page paintParent.htm should open and it has 1line of text in it. Through exp.htm we are appending one line of text to paintParent.htm. paintParent.htm is changing background color of exp.htm The codes are given below --

exp.htm
--------


<html>
<head>
<script type="text/javascript">

function openNewLink() {

var newwindow = window.open("paintParent.htm","mywindow","width=40 0,height=300");
//newwindow.focus();

newwindow.document.open();
newwindow.document.write("<b>this is exp.htm</b>");
newwindow.document.close();

return false;

}
</script>
</head>

<body>
<p> Click below to open paintParent.htm page and it will also change backcolor of this page to

red</p>

<a href="" onclick = "return openNewLink()">click here</a>
</body>

</html>


paintParent.htm
---------------


<html>
<script type="text/javascript">
//this file will paint exp.htm when that file is opened.

document.write("this is paintParent.htm");
window.opener.document.bgcolor = "RED";

</script>
</html>
Reply With Quote