SitePoint Sponsor

User Tag List

Results 1 to 23 of 23
  1. #1
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Opening link in parent window from pop up

    I need to have a link open in the parent window after opeining one on my site.
    What the user does, is he/she clicks a link in their browser. that intern opens another window with a input field and a submit button. after they hit submit, i want the next page to load in the window they first clicked the link for the pop up.
    how would i do this?
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  2. #2
    SitePoint Enthusiast JohnInFl's Avatar
    Join Date
    Sep 2001
    Location
    FL, USA
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Should be parent.window.location=URL

    or
    parent.window.open(parameters)

  3. #3
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so in the input tag should i have this?
    Code:
    <input type="submit" onClick="parent.window.location=/add_mail.php">
    and what should i have in the action part of the <form> tag?
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  4. #4
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    That's wrong...

    top.window.opener.location.href='blah.php'
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  5. #5
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so what should the tag look like?
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  6. #6
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    <a href="javascript:window.opener.location.href='blah.php';">Open Blah Page</a>
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  7. #7
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this needs to happen when i submit a form.
    so would
    Code:
    <input type="submit" onClick="javascript:window.opener.location.href='blah.php';">
    work?
    hmm... it put a space into javascript...
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  8. #8
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    yeah, that's fine
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  9. #9
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm... it almost works.
    it's opening that file in the parent window, but it's not sending the form value along with it.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  10. #10
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Oh you want it submitted to that window?

    Code:
    <form action="blah.php" method="post" target="mainwindow">
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  11. #11
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, this almost works.
    now it doesn't load in the pop-up window, but it doesn't load in the window that that pop up came from either.
    it opens a new full browser window.

    also, if i put a self.close() in with the submit button, will it submit the info then close the pop up?
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  12. #12
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anybody have an idea??
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  13. #13
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Sorry mate... I'm stumped...

    The only thing I can think of is to have all the form elements in your parent window as well and to have a function to transfer the data from the form in the popup to the main form, then submit that form, then close the window...
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  14. #14
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried target="_parent"?
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  15. #15
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lemme try.

    nope, loads in the pop up window.

    btw, if i put
    Code:
    onClick="javascript:self.close()"
    in the submit tag, woudl it close the window AFTER the info was sent?
    i can deal with that second popup, but i really wanna close the first so they don't submit the info twice.
    Last edited by Defender1; Oct 4, 2001 at 22:46.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  16. #16
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    grrr! why does vB put a space in javascript when you use the code tag?
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  17. #17
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To prevent malicious mischief.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  18. #18
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So any ideas on what i posted up ther?
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  19. #19
    SitePoint Member
    Join Date
    Jan 2002
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy I have some

    I am dealing with something similar in my work now, which is how I found this discussion.

    The "_parent" reserved target name only applies to the parent FRAME, not popup windows. The browser makers have not caught on to theis little problem.

    You might try giving your parent window a name like this.

    <body Onload="window.name = 'WhosYourDaddy';">

    then target your form to target="WhosYourDaddy"

    Anyway, that is what I am trying to do now...

    I'll letcha know if it ISN'tT on the right track.

  20. #20
    Xbox why have you forsaken me? moospot's Avatar
    Join Date
    Feb 2001
    Location
    Clearwater, FL
    Posts
    3,615
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Now I've got a question:

    Is it better (faster, less processing time, etc.) to use an inline script like this:

    Code:
    <a href="java script:window.open('image_640.asp?img=<%= image_file %>',scrollbars=no,menubar=no, width=640, height=480);">
    or use a function like so:

    Code:
    function open640(URL) {
    window.open(URL,"thisName","'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,directories=0,height=640,width=480,left = 0,top = 0'");}
    
    <a href="java script:open640('image_640.asp?img=<%= image_file %>');">

    ???

  21. #21
    SitePoint Member
    Join Date
    Jan 2002
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In my experience there isn't any processor difference. If you already have an extrenal .js file that you keep scripts in then using that can be considerably faster, since it shortens the length of your each HTTP page transfer and can be cached, BUT...

    If you are using ASP to dynamically generate peices of the JS script, then it becomes more complicated to put that kind of code in a JS file. Also, the advantages, more or less disappear at the point where you are no longer able to cache the file.

    Therefore, inline code is probably better, but there is no clear advantage to putting all your code directly into the tag. In fact, that makes it very difficult to debug since most script editors work on line numbers anyway. So, my recommendation is to use script blocks and functions.

    That's about it for me.

    By the way, I wasn't sure this would work last time, but now I am totally sure, since I tested it. In fact, I now have it set up not only to submit the form to the opener page, but then to delay for a bit and refresh the form pop-up after the parent page completes a reload. It turned out to be very useful.

  22. #22
    Xbox why have you forsaken me? moospot's Avatar
    Join Date
    Feb 2001
    Location
    Clearwater, FL
    Posts
    3,615
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the advice, Doc I am using the function now, because I just like using it more than the inline version.

    Besides, I might someday get organized and place all my scripts in one file.

  23. #23
    SitePoint Member
    Join Date
    Jan 2002
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    np. any time.


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
  •