Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Need help with a form! Need to close parent window on redirect.

  1. #1
    Join Date
    Feb 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need help with a form! Need to close parent window on redirect.

    I haven't done JavaScript in such a long time. I have a [FORM] button that when clicked on, redirects to a webpage. I need it to close the parent window after they click on the button.

    When they visit my site, if they are a guest, they are greeted with a popup. If members want to log in, they click on the log in button. It redirects to the webpage great, but it leaves the original window up. What can I put in my code to get it to close that window out?

    Heres the code that I have.

    <form>
    <input type="button" value="Log In"
    onclick="window.open('http://aquatopiaforum.com/index.php?act=Login&CODE=00')">
    </form>


    Thanks in advance!

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    onclick="window.open('http://aquatopiaforum.com/index.php?act=Login&CODE=00');window.close();"
    ... maybe?
    You need to always provide a normal HTML form submission as a backup. In your case, you'd do something like this:
    Code:
    <form target="_blank" action="/index.php" method="get">
      <input type="hidden" name="act" value="Login" />
      <input type="hidden" name="CODE" value="00" />
      <input type="submit" value="Log In" onclick="window.close();" />
    </form>
    Add whatever Javascript you need on top of that, but make sure it works without Javascript too.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Feb 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Heres the code for the 'splash screen.'
    Thanks for the info.

    Not sure exactly where to put my website so it will direct though. Like I said, it's been awhile.

    <form target="_blank" action="/index.php" method="get">
    <input type="hidden" name="act" value="Login" />
    <input type="hidden" name="CODE" value="00" />
    <input type="submit" value="Log In" onclick="window.close();" />
    </form>


    <html>
    <body bgcolor="0066cc" onLoad="if (self != top) top.location = self.location">
    <IMG SRC="F:/HTML/aquabanner.png" ALT="AquaTopiaForum.com">
    <br>
    <br>


    <TABLE BORDER CELLSPACING=0 BORDERCOLOR="000000" WIDTH=60% RULES=GROUPS FRAME=BOX>
    <TR>
    <TH COLSPAN=2 BGCOLOR="#99FFFF">Welcome, Guest!</TH>
    </TR>

    <TR> <TD BGCOLOR="#FFFFFF"><IMG SRC="F:/mazzaavatar.png" ALT="MAZZATAR" ALIGN=LEFT></TD>
    <TD BGCOLOR="#FFFFFF">
    <BR>
    <P><B>I see that you haven't registered yet.</B></P>
    <P>As a registered member, you will enjoy all of the following benefits:
    <UL>
    <LI><I>The ability to post in most forums.</I>
    <LI><I>You will be able to visit the member map.</I>
    <LI><I>You will no longer have to view google ads.</I>
    <LI><I>You will have the opportunity to earn AquaToken rewards.</I>
    <LI><I>Most importantly you won't see this little pop-up!</I>
    </UL>

    <P>Registration is <I>fast</I> and <I>easy.</I></P>
    <P>You have nothing to lose and everything to gain by joining our growing community of Aquarium hobbyists!</P>
    </TD>
    <TR> <TD BGCOLOR="#FFFFFF"></TD>
    <TD BGCOLOR="#FFFFFF">

    <form>
    <input type="button" value="Register"
    onclick="window.open('http://aquatopiaforum.com/index.php?act=Reg&CODE=00')">
    </form>
    </P>
    <HR = 1>
    <TR> <TD BGCOLOR="#FFFFFF"></TD>
    <TD BGCOLOR="#FFFFFF">
    <BR>
    <P>Already a registered member of AquaTopiaForum.com?</P>
    <TR>
    <TD BGCOLOR="#FFFFFF"></TD>
    <TD BGCOLOR="#FFFFFF">


    <form>
    <input type="button" value="Log In"
    onclick="window.open('http://aquatopiaforum.com/index.php?act=Login&CODE=00')">



    <form method="post">
    <input type="button" value="Later"
    onclick="window.close()">
    </form>


    </TABLE>
    </HTML>

  4. #4
    Join Date
    Feb 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Actually, instead of pointing to the same site, I actually need it to point to www.aquatopiaforum.com/index.php.

    It's pointing to our free webspace instead of our forum. Any idea what I can change _blank to?

    Thanks for the quick reply!
    Last edited by aquatopia_mazza402; 02-20-2006 at 09:11 PM.

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    <html>
    <body style="background-color:#0066cc;" onload="if (self != top) top.location = self.location">
    <IMG SRC="F:/HTML/aquabanner.png" ALT="AquaTopiaForum.com">
    <br>
    <br>
    
    
    <TABLE BORDER CELLSPACING=0 BORDERCOLOR="000000" WIDTH=60% RULES=GROUPS FRAME=BOX>
    <TR>
    <TH COLSPAN=2 BGCOLOR="#99FFFF">Welcome, Guest!</TH>
    </TR>
    
    <TR> <TD BGCOLOR="#FFFFFF"><IMG SRC="F:/mazzaavatar.png" ALT="MAZZATAR" ALIGN=LEFT></TD>
    <TD BGCOLOR="#FFFFFF">
    <BR>
    <P><B>I see that you haven't registered yet.</B></P>
    <P>As a registered member, you will enjoy all of the following benefits:
    <UL>
    <LI><I>The ability to post in most forums.</I>
    <LI><I>You will be able to visit the member map.</I>
    <LI><I>You will no longer have to view google ads.</I>
    <LI><I>You will have the opportunity to earn AquaToken rewards.</I>
    <LI><I>Most importantly you won't see this little pop-up!</I>
    </UL>
    
    <P>Registration is <I>fast</I> and <I>easy.</I></P>
    <P>You have nothing to lose and everything to gain by joining our growing community of Aquarium hobbyists!</P>
    </TD>
    <TR> <TD BGCOLOR="#FFFFFF"></TD>
    <TD BGCOLOR="#FFFFFF">
    
    <form target="_blank" action="/index.php" method="get">
      <input type="hidden" name="act" value="Reg" />
      <input type="hidden" name="CODE" value="00" />
      <input type="submit" value="Log In" onclick="window.opener.close();" />
    </form>
    </P>
    <HR = 1>
    <TR> <TD BGCOLOR="#FFFFFF"></TD>
    <TD BGCOLOR="#FFFFFF">
    <BR>
    <P>Already a registered member of AquaTopiaForum.com?</P>
    <TR>
    <TD BGCOLOR="#FFFFFF"></TD>
    <TD BGCOLOR="#FFFFFF">
    
    
    <form target="_blank" action="/index.php" method="get">
      <input type="hidden" name="act" value="Login" />
      <input type="hidden" name="CODE" value="00" />
      <input type="submit" value="Log In" onclick="window.opener.close();" />
    </form>
    
    <button onclick="window.close();">Later</button>
    
    </table>
    </html>
    I've applied the code. I started hacking away at your HTML errors, too, but there are too many for one sitting: I suggest you run it through a validator.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Feb 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Will do. Any way to get it to direct to aquatopiaforum.com instead of _blank and /index.php?

    I need it to point to our forum login page.

    I'll run it through a validator as soon as I get a chance. Thanks for the tip.

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Presuming your index.php page is located at http://www.aquatopiaforum.com/index.php, and that page is on the same domain, it will redirect to it.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #8
    Join Date
    Feb 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It's actually not on the same domain though, thats the problem I am running into. It's a geocities website that we are using for the splash page, and that is pointing to our domain.

  9. #9
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Ah, OK. In that case, just replace /index.php with the full URL to your index.php, as you did earlier.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  10. #10
    Join Date
    Feb 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sounds good. I'll give that a try. Thanks a bunch for the help.

    So it's _blank and then replace index.php with the full URL?

    For some reason I think I gave that a try and it actually tried to put it as http://www.geocities.com/www.aquatop....com/index.php.

    Am I doing something wrong?

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
  •