Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: Beginning JavaScript 2nd Edition
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning JavaScript 2nd Edition For questions about Beginning Javascript 2nd Edition by Paul Wilton. (ISBN: 0-7645-5587-1). Published April 2004. For Javascript questions not specific to this book, please see the Javascript forum. If you have the 1st edition, please continue to use that forum instead at: http://p2p.wrox.com/forum.asp?FORUM_ID=21
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning JavaScript 2nd Edition section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 1st, 2010, 10:01 AM
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
  #2 (permalink)  
Old April 1st, 2010, 10:31 AM
Friend of Wrox
 
Join Date: Dec 2008
Location: , , .
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
Default

spell 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>
Reply With Quote
  #3 (permalink)  
Old April 1st, 2010, 11:42 AM
Registered User
 
Join Date: Apr 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank You Peter for your reply. Actually after posting this I too realised this mistake. The problem now exists is that I'm expecting ouput in the new window opened as -

this is paintParent.htm this is exp.htm but this is only printing
this is exp.htm. Why is it not printing this is paintParent.htm?

also I have been using notepad as well as visual studio for writing javascript codes but not satisfied...
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
window.opener for mozilla jun99 Javascript 3 September 1st, 2009 08:57 AM
Problem accessing the window.opener.opener maryuob Javascript 3 January 18th, 2006 04:25 AM
window.opener problems crmpicco Javascript How-To 2 September 30th, 2005 03:46 AM
window.opener help fs22 Javascript How-To 6 May 9th, 2004 10:50 PM
window.opener.refresh matt.fields Javascript How-To 1 November 3rd, 2003 04:13 AM



All times are GMT -4. The time now is 11:26 AM.


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