Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts

    Call a function in parent window from child window

    How do / Can you call a function in the parent window from a child window that I've opened with window.open?

    like:

    onclick="parent.myFunction();"

    TIA

    Basscyst

  • #2
    New Coder
    Join Date
    Aug 2003
    Location
    Rhondda Cynon Taff, Wales
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, that is exactly right and, you got it first time - not like me!
    Ryan Jones(sciguyryan)
    Visit us and chat at our forums - the Kidscript Forums

  • #3
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    That doesn't seem to work though. This is the code I have:

    <script language="javascript">
    function testIt()
    {
    alert();
    }

    myWindow=window.open("","myWindow","status=no,location=yes,toolbar=yes,directories=no,resizable=yes, width=600,height=400,top=100,left=100,scrollbars=yes");
    myWindow.document.open();
    myWindow.document.writeln("<center><table border=1 bgColor=C3DEF1 style='text-align:center;'><tr><td><b>Shift Time<td><b>Date<td><b>Name<td><b>ID<td><b>Time Requested</b></td></tr></table><br><input type='button' value='Mark As Logged' onclick=javascript:parent.testIt();>");
    </script>

  • #4
    New Coder
    Join Date
    Aug 2003
    Location
    Rhondda Cynon Taff, Wales
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hmm, odd i cant even get access to the file - I will see what i can do.
    Ryan Jones(sciguyryan)
    Visit us and chat at our forums - the Kidscript Forums

  • #5
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    In the case of popups instead of frames: parent --> opener
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #6
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    Thank You Kindly. That did the trick!!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •