www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > JavaScript

    JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...)

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 01-02-2003, 12:33 PM
    reenadpatel reenadpatel is offline
    Registered User
     
    Join Date: Jan 2003
    Posts: 7
    Update parent window from child

    In Javascript I need to update the parent window with the contents of a file. The child window displays a list of files. So when the user selects the file, I need to close the child window and open the file in the parent window. I have a function for opening the file in the parent window. I want to call this function from the child window.

    Can someone help me with this?


    Thanks for the reply but..

    I am using arrays for displaying the data in parent form from file selected from child form. So the array declaration and the function to fill the array data is in the parent form. I need to call this function from child form to display the file in the parent form. I am not able to access this parent form function. What is the right syntax for accessing a parent form function from a child form?

    Last edited by reenadpatel; 01-02-2003 at 01:07 PM.
    Reply With Quote
      #2  
    Old 01-02-2003, 12:50 PM
    khalidali63's Avatar
    khalidali63 khalidali63 is offline
    Registered User
     
    Join Date: Dec 2002
    Location: Calgary, Canada
    Posts: 2,654
    xThe code snippet below will do just that


    <html>
    <head>
    <title>Interaction with Pop Up Window - child/parent</title>
    <script>
    function openPopup(){
    var popupWin = window.open("Blank.html","popupWin","width=300,height,300,scollbar=no,addressbar=no");
    popupWin.document.open();
    popupWin.document.write("<a href=\"javascript:top.opener.document.location.href='http://www.cnn.com';self.close();\"\">Open CNN in parent Frame</a>");
    popupWin.document.close();
    }
    </script>
    </head>

    <body>
    <a href="javascriptpenPopup();">Open Popup</a><br><br>

    </body>
    </html>

    Khalid
    Reply With Quote
      #3  
    Old 01-02-2003, 12:52 PM
    Charles's Avatar
    Charles Charles is offline
    JavaScript Banned
     
    Join Date: Nov 2002
    Location: Baltimore, Maryland
    Posts: 11,667
    First, make sure that you are opening the child window properly:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="Content-Script-Type" content="text/javascript">
    <title>Test</title>
    <p><a href="test1.html" onclick="window.open(this.href, '', 'height=300,width=200'); return false">Child</a></p>

    And then in your child window:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="Content-Script-Type" content="text/javascript">
    <title>Test1</title>
    <p><a href="http://www.w3.org/" onclick="if (window.opener) {window.opener.location=this.href; return false}">W3C</a></p>
    __________________
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

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


    All times are GMT -5. The time now is 06:09 AM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.