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 7 of 7
  1. #1
    New Coder
    Join Date
    Aug 2002
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    can't open target page in separate frame

    Hi
    Would someone be able to help me please? I'm trying to get the new page that this script brings up to load in another frame called "middle", rather than in the same frame, but I can't see how to do it.
    Would be very grateful for any help.
    Thanks
    Beck

    <HTML>
    <HEAD>
    <TITLE>Candidates</TITLE>
    <SCRIPT LANGUAGE="JavaScript">
    <!--- Hide from tired old browsers that should be put to pasture.

    ////////////////////////////////////////////////////////////////////
    /// Get your very own Gate Keeper from Professional Web Design ///
    /// http://junior.apk.net/~jbarta/weblinks/gate_keeper/ ///
    ////////////////////////////////////////////////////////////////////

    function goForit() {
    var location;
    var password;
    password=this.document.testform.inputbox.value
    location=password + ".html"
    fetch(location)
    theKeeper=window.close()
    }

    function fetch(location) {
    var root;
    if (opener.closed) {
    root=window.open('','theKeepersGopher','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=y es,resizable=yes,copyhistory=no');
    root.location.href = location;
    } else {
    opener.location.href = location;
    }
    }

    // End hiding --->
    </SCRIPT>
    <style type="text/css">
    <!--
    .body { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; color: 333399}
    -->
    </style>
    </HEAD>

    <BODY bgcolor="#FFFFFF">
    <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
    <TR valign="top">
    <TD ROWSPAN=2 WIDTH=50%><img src="images/logo.gif">
    <TD WIDTH=50% ALIGN=CENTER> <FONT FACE="ARIAL" SIZE=2><span class="body">This
    section is password protected. Please enter the password you have been provided.</span></FONT>
    <TR>
    <TD WIDTH=50% ALIGN=CENTER>
    <CENTER>
    <p>&nbsp;</p><FORM NAME="testform">
    <p>
    <INPUT TYPE="text" NAME="inputbox" VALUE="" size=20>
    </p>
    <p>
    <INPUT TYPE="button" NAME="button" Value="Submit Password" onClick="goForit(this.form)">
    </p>
    </FORM>
    </CENTER>


    </TABLE>

    </BODY>

    </HTML>

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Flint, Michigan, USA
    Posts
    629
    Thanks
    1
    Thanked 20 Times in 20 Posts
    Change the following:

    if (opener.closed) {
    root=window.open('','theKeepersGopher','toolbar=yes,location=y
    es,status=yes,menubar=yes,scrollbars=yes,resizable =yes,copyhistory=no');
    root.location.href = location;
    } else {
    opener.location.href = location;
    }

    to:

    window.frames['middle'].location=location;

  • #3
    New Coder
    Join Date
    Aug 2002
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi
    This doesn't seem to work - no page is loaded anywhere - I think it may be looking for a frame called 'middle' within the pop-up window that contains this script - rather than the root opener window.
    I need to somehow target a frame within the opener window. Any ideas?

    Thanks
    Beck

  • #4
    Regular Coder
    Join Date
    Apr 2004
    Location
    Canada
    Posts
    302
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question

    I'm a rank beginner at Javascripting, so you experts, don't shoot me down....

    Beck, I'm wondering if you could do something along this line:


    function opensetAttribute(){
    ('target','middle');
    }

    Of course, you probably have to add "root" somewhere there to get the browser to look for the middle frame on the root rather than opening yet another window.

    I hope that helps rather than hinders.

  • #5
    New Coder
    Join Date
    Aug 2002
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks it gave me a few ideas to try - none of which have worked...
    Any other advice out there?

    Thanks
    Beck

  • #6
    New Coder
    Join Date
    Aug 2002
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Got it - yay!

    function fetch(location) {
    var root;
    if (opener.closed) {
    root=window.open('','theKeepersGopher','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=y es,resizable=yes,copyhistory=no');
    root.location.href = location;
    } else {
    opener.parent.middle.location.href = location;
    }
    }

  • #7
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    shorter solution:

    window.open(location, 'middle');
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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