CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 1999
    Location
    New Jersey, USA
    Posts
    369

    URGENT! PLEASE HELP: Change main web page from popup?

    Hi,

    My main web page creates the below popup. I want to click a link in my popup and have my main web page go to the url. I do not care if the popup remains open at that point or not (I'd rather it close actually).

    How do I do this?

    HTML Code:
    <map name="Map">
    <area shape="rect" onmouseover="ChangeCursor();" onmouseout="ChangeCursorBack();" coords="295, 72, 445, 95" target="_blank" style="cursor:hand" onclick="var myWindow = window.open('Flash/treeredone.asp','ORGCHART','height=600,width=800,top=0,left=0,scrollbars=no');">
    </map>
    I wish I was as smart as I am confused...argh!

  2. #2
    Join Date
    May 2004
    Location
    MN / NJ, United States
    Posts
    768

    Re: URGENT! PLEASE HELP: Change main web page from popup?

    Your pop-up's target would simply have to point to the opener. That isn't enough code for me to see what you are doing .. is that opening the pop-up, or is that code on the pop-up ... please explain.
    *9-11-01* Never Forget; Never Forgive; Never Relent!
    "If we ever forget that we're one nation under God, then we will be a nation gone under." - Ronald Reagan

  3. #3
    Join Date
    May 1999
    Location
    New Jersey, USA
    Posts
    369

    Re: URGENT! PLEASE HELP: Change main web page from popup?

    Hello, thank you for your reply.

    The code in the snippet is in the opener. In other words, the code in the snippet opens the popup.

    What would the code in the popup look like to change the opener's page ?
    I wish I was as smart as I am confused...argh!

  4. #4
    Join Date
    Dec 2005
    Posts
    62

    Re: URGENT! PLEASE HELP: Change main web page from popup?

    Here is a basic version

    Code:
    <script type="text/javascript">
    function winopen(){
    win = window.open('','_blank');
    win.document.open;
    win.document.write('<a href="javascript:" onclick="opener.location=\'http://www.google.com\'">click</a>')
    win.document.close();
    }
    </script>
    <a href="javascript:" onclick="winopen()">click</a>

  5. #5
    Join Date
    Jul 2004
    Location
    Mumbai
    Posts
    11

    Re: URGENT! PLEASE HELP: Change main web page from popup?

    U can access the main page's elements from the popup by
    simply replacing 'document.something' in main page's JS with 'window.opener.document.something' in popup page's JS.

    a sample code would look like
    window.opener.projForm.search2.value="done";

    I hope this is the relevant answer
    Last edited by amitvb; February 7th, 2006 at 09:22 AM.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured