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 8 of 8
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Location
    New Zealand
    Posts
    127
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Popup window link target original window?

    I have a little pop up window that displays the latest features of a website. I was wanting the normal <a href> links in this small popup window to target the original main page window.

    The original window was never "created' so is not named, is it possible to name the window somehow and just target it with a simple <a target> or is there more to it?

    I have seen this done with the log in window on www.domainz.net.nz but am not sure where to start.

    Thanks.
    Last edited by Candrias77; 09-26-2002 at 01:16 PM.
    eTheory - the theory of revolution

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Try the following


    In the main page


    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function newWindow(file,window) {
    msgWindow=open(file,window,'resizable=no,width=200,height=200');
    if (msgWindow.opener == null) msgWindow.opener = self;
    }
    //-->
    </SCRIPT>

    <FORM>
    <INPUT TYPE="button" VALUE="Open New Window" onClick="newWindow('a.html','window2')">
    </FORM>



    In the document loaded into the popup


    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function load(file,target) {
    if (target != '')
    target.window.location.href = file;
    else
    window.location.href = file;
    }
    //-->
    </SCRIPT>

    <A HREF="javascript:load('b.html',opener)">load document into opener</A>

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Posts
    1,404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    No more to it. Name that window:

    <script type="text/javascript" language="javascript">

    self.name = 'Candrias77';

    </script>

    Then:

    <a href="...." target="Candrias77">

  • #4
    Regular Coder
    Join Date
    Jul 2002
    Location
    New Zealand
    Posts
    127
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yep, it was as simple as you said adios

    thanks
    eTheory - the theory of revolution

  • #5
    New to the CF scene
    Join Date
    May 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    link coding

    suppose if we are hyperlinking a keyword, for example Search Engine Optimisation, to hyper link a keyword we use html. So is it also a type of coding.
    Last edited by johntod02; 05-13-2009 at 01:53 PM.

  • #6
    New to the CF scene
    Join Date
    May 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    good post

  • #7
    New to the CF scene
    Join Date
    Oct 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by adios View Post
    No more to it. Name that window:

    <script type="text/javascript" language="javascript">

    self.name = 'Candrias77';

    </script>

    Then:

    <a href="http://codingforums.com/html-css/...." target="Candrias77">
    I know this is an old post but this is the method I have used. But, my pop up window doesn't close. Any way to trigger that as well? Or am I going to have to head to the window.opener method?

  • #8
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,719
    Thanks
    80
    Thanked 4,514 Times in 4,478 Posts
    Tacky coding, but it works:
    Code:
    <a href="http://codingforums.com/html-css/html-css/...." target="Candrias77" onclick="self.close();return true;">
    But I really think that
    Code:
    <input type="button" value="whatever" 
           onclick="window.opener.location.href='whatever.html'; self.close();" />
    is cleaner. You can easily style the button to make it look like a link if you prefer.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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