Results 1 to 7 of 7

Thread: Trying to close a window within itself.

  1. #1
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Trying to close a window within itself.

    Hi,

    I'm using Popup Windows ( http://www.dynamicdrive.com/dynamicindex11/abox2.htm ), and I need to close a window generated by it within the window itself. I've tried to use hidebox(ID), but it only works on a opened popup. Can anyone help me?

    Thanks.

    Regards,

    Eric Saboia

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Why would you want to close an unopened pop up?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I should right opener (parent document) and not opened. Im sorry.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I'm still not clear on where you are trying to do what from.

    I think the what is - close a pop up pseudo window created by this script.

    I think where is from some other window other than the one in which the pop up pseudo window created by this script resides.

    Cross window scripting is fairly easy but, can get tricky when windows are opened and closed and/or reused after being initially created. The basic idea is that anything on the child window can be accessed from the opener if it was opened using javascript and assigned a variable at that time:

    Code:
    var mynewwin=window.open('some.htm');
    Now, from the page (not the window) that opened some.htm in this manner, things on some.htm become (for example its document.title becomes):

    Code:
    mynewwin.document.title
    Going in the other direction is even easier. To access something on the parent window from the child, it makes no difference how the child was opened, the parent is always (on the child window's page) the opener. The parent's title would be (from the child):

    Code:
    opener.document.title
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    index.php:
    new popUp(0, 0, 773, 385, unique, "<iframe src='"+acao+"_prod.php?id_prod="+id_prod+"&id_div="+unique+"' name='main' width='100&#37;' height='100%' marginheight='1' scrolling='Auto' frameborder='0' id='main'></iframe>", "white", "black", "bold 10pt sans-serif", "Informa&#231;&#245;es do produto", "navy", "white", "#dddddd", "gray", "black", true, false, false, true, false);

    I want to close (or hide) the popUP using a link inside the acao_prod.php (iframe link thats loaded inside the pseudo window). Just like the [x] on titlebar of pseudo window.

    Sorry for the bad english..

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That's a little different. You are not dealing with an opener or with a child window created as I indicated. You can still do it. What you have is a parent page:

    index.php

    and a child iframe:

    Code:
    <iframe src='"+acao+"_prod.php?id_prod="+id_prod+"&id_div="+unique+"' name='main' width='100%' height='100%' marginheight='1' scrolling='Auto' frameborder='0' id='main'></iframe>
    This child iframe contains a page:

    acao_prod.php

    on acao_prod.php things on index.php would be parent.object so, from my previous example, index.php's title would be from acao_prod.php:

    parent.document.title

    and what you seem to be after would be:

    parent.hidebox(ID)
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks!!

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
  •