Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0
This is the forum to discuss the Wrox book Professional JavaScript for Web Developers by Nicholas C. Zakas; ISBN: 9780764579080
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 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
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 28th, 2005, 09:50 AM
Authorized User
Join Date: Jun 2005
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Accessing a element of parent window in child wind


Below is a function in my aspx page called Parent.aspx.I'm calling it on click event of a button on this page.
function fnParentFrmSubmit()
            document.body.insertAdjacentHTML("beforebegin","<i nput type=text id='txtBox' value='Y'>");

<input type="button" value="Submit" id="btnSubmit" onclick="javascript:fnParentFrmSubmit()">

...And the below function is in another page called Child.aspx which I'm calling on Page_Load event

function fnChildWinLoad()


When the user clicks on the submit button,I am submitting the form thru' client side javascript and then in the code behind

of this page,I am opening a Child.aspx using Response.write("<script language='javascript'>window.open(Child.aspx,'abcd ')")

I am creating a textbox element dynamically and then trying to access its value in the child element.
But I am getting javascript error 'window.opener.document.forms[0].txtBox.value' is not an object or is null.
I tried using window.opener.document.getElementById("txtBox").va lue,but still I get the same javascript error.

Any idea where am I going wrong..??

Thanks in advance..

Reply With Quote
  #2 (permalink)  
Old June 28th, 2005, 10:26 AM
nzakas's Avatar
Wrox Author
Join Date: Dec 2004
Location: Peabody, MA, USA.
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts

You are doing the reverse of what you are trying to do. To access a textbox in a popped up window from the main window, you must do this:

var oWin = window.open(...);
For future reference, this forum is for questions and comments directly relating to the book. Please use the general JavaScript forum for questions such as this.

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Closing parent window from child window arnabghosh Javascript How-To 1 December 26th, 2007 01:18 AM
closed parent window when opened child window jaiwin Javascript How-To 0 October 8th, 2006 12:54 PM
Propogating changes in child window to parent Scripts82 ASP.NET 1.0 and 1.1 Basics 4 September 22nd, 2006 07:07 AM
Close Parent window on opening child window pkdev Javascript How-To 8 April 11th, 2004 12:06 PM
Accessing parent control functions from child badgolfer VS.NET 2002/2003 2 January 9th, 2004 07:49 AM

All times are GMT -4. The time now is 11:45 PM.

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