SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member i_slim's Avatar
    Join Date
    Oct 2003
    Location
    edinburgh
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript targeting a window which it didn't open

    Hi all,
    I open a popup window (called jsWindow) using js from a window called oldPage.
    I then navigate from oldPage to newPage. I now want to control jsWindow and call a function in there.

    I can do this via a link in newPage:
    <a href="javascript:jsFunction()" target="jsWindow">click here</a>

    However, I need to call jsFunction() from an onLoad command. How do I target jsWindow?


    The reason for this is that oldPage submits a form and generates jsWindow with a "please wait" signal. The jsWindow should remain until newPage has finished downloading. newPage must then tell jsWindow to close.

    phew, does that make sense?

  2. #2
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried onLoad="jsWindow.jsfunction()"

  3. #3
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    By 'called jsWindow', did you mean...
    Code:
    window.open('...', 'jsWindow', '......
    If so...
    Code:
    <script type=text/javascript">
    
    onload = function()
    {
        var oWindow = window.open('', 'jsWindow');
        if (oWindow && !oWindow.closed)
            oWindow.close();
    }
    
    </script>
    You could also go oWindow.jsFunction(), but if you're just closing, might as well do it remotely.
    ::: certified wild guess :::


Bookmarks

Posting Permissions

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