p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning JavaScript 3rd Ed. ISBN: 978-0-470-05151-1 (http://p2p.wrox.com/forumdisplay.php?f=331)
-   -   can any1 solve window.open() and window.opener issues (http://p2p.wrox.com/showthread.php?t=78807)

abhihello123 April 1st, 2010 10:04 AM

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>

PeterPeiGuo April 1st, 2010 10:30 AM

bgcolor should be spelled as bgColor with captial C:
Code:

<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>



All times are GMT -4. The time now is 02:06 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.