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

Thread: DHTML Window Widget opening into _parent or other iframe?

  1. #1
    Join Date
    Mar 2007
    Posts
    32
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default DHTML Window Widget opening into _parent or other iframe?

    1) Script Title:
    DHTML Window Widget

    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...ndow/index.htm

    3) Describe problem:
    Not really a problem, but I was playing around with this function to learn how it works, and I wish to do something it doesn't handle at the moment.

    A quick explanation of what my problem looks like.

    I have a main page with 4 iframes on it, one of which is the "main" output iframe. And when I click on a link there I want a window to pop up in a simillar
    way that this Widget does.

    But, currently it created the popped up window in the iframe where the link
    was, and I want it to be created in the "main" _parent window.

    It should be doable, but not certain how. Tried modifying some stuff, but it
    didn't work as planned.

    Also, it would be interesting if one could add a "targetname" so it could open
    the popup into another named iframe, which in reality should solve my
    problems.

  2. #2
    Join Date
    Mar 2007
    Posts
    32
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    To clarify:

    Opening a window popup inside an iframe limits it to that iframe when it comes
    to movement and screen coverage, but if it was possible to open it in the
    _parent it should be able to span over all existing iframes, right?

    Otherwise opening it into a different iframe is an acceptable sollution, even thou
    it wont be as "pretty".

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

    Default

    if it was possible to open it in the
    _parent it should be able to span over all existing iframes, right?
    Not necessarily. In some cases, iframes show through content on top of them.

    It's possible to do what you ask by modifying all instances of "document" in the script to refer to the appropriate document instead, but it's easier to have the script in the document where you want it to appear, then call it like:
    Code:
    frames['main-frame'].dhtmlwindow.open(...);
    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!

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

    Default

    Thanks, but I tried doing:

    frames['d_top'].dhtmlwindow.open(...);

    where d_top is a frame which contains a html page (with the javascript loaded ofcourse), but it doesn't show anything in it.

    And is it possible to name the main window in some way, or does it always have to be '_parent'?

    Oh, and I tried frames['_parent'].dhtmlwindow.open(...); aswell and nothing happend.

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

    Default

    Firstly, you do realise that '...' is an ellipsis, representing the normal arguments?
    Secondly, the parent window is simply parent, not frames['_parent'].
    Thirdly, saying 'it doesn't work' is no help at all: you should show the error(s) produced.
    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
    Mar 2007
    Posts
    32
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey View Post
    Firstly, you do realise that '...' is an ellipsis, representing the normal arguments?
    Secondly, the parent window is simply parent, not frames['_parent'].
    Thirdly, saying 'it doesn't work' is no help at all: you should show the error(s) produced.
    1. Ofcourse I realise that and am sending the correct parameters, since it works when using the popup within the iframe that created it.
    2. Thanks.
    3. Well, it doesn't produce any errors, it just doesn't work. Like when you try to send something to a frame using a targetname that doesn't exist.

    Thanks, but next time, don't be so condescending please. Atleast its how your reply felt to me.

    edit:
    I tried using parent.dhtmlwindow.open(...); but still got nothing.. when I just use the dhtmlwindow.open(...); the window do open as intended in the iframe that created it, but I cant get it to pop up in any other iframe (or main html window). And yes, I've included the files on all related pages ofcourse.
    Last edited by Luterin; 03-30-2007 at 02:42 PM.

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

    Default

    3. Well, it doesn't produce any errors, it just doesn't work. Like when you try to send something to a frame using a targetname that doesn't exist.
    That doesn't happen here. If the frame didn't exist, a "frames['d_top'] has no properties" (or similar) error message would be thrown. May I see your page?
    1. Ofcourse I realise that and am sending the correct parameters, since it works when using the popup within the iframe that created it.
    The first thing you learn to do around here is to never assume any knowledge on the part of the OP In fact, even knowledgeable people often make daft mistakes, so there is no "of course" about it.
    Thanks, but next time, don't be so condescending please. Atleast its how your reply felt to me.
    It wasn't intended to be, but neither did I spend a lot of time softening it. This is common when asking for technical help: people usually assume you'd rather they got the problem sorted as fast as possible, rather than wasting time trying not to hurt their feelings.

    Also, you evidently haven't read some of the other threads here. The number of them in which the OP has made a single, incredibly obvious mistake are astonishing.
    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
    Mar 2007
    Posts
    32
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    That doesn't happen here. If the frame didn't exist, a "frames['d_top'] has no properties" (or similar) error message would be thrown. May I see your page?
    Oh, ok. I had my Error Console messed up it seems, but yeah, now I get an error. And you are right, it's "frames.d_top has no properties"

    And about showing you my code, well, it's not really useful I think, and I really have myself to blame for doing it this way.

    I had a working system that used normal frames with a list in the main frame, which opened up new pages in the "main" frame as the list items were clicked.

    I am trying to do a quick change to use iframes instead of normal frames and have the new pages pop up in a window instead of the "main" frame.

    I know I should have done a few small pages and tested things out first, but I'm impatient like that and like to just toss things into the mix and see what happends. Trial & Error!

    The first thing you learn to do around here is to never assume any knowledge on the part of the OP In fact, even knowledgeable people often make daft mistakes, so there is no "of course" about it.
    It wasn't intended to be, but neither did I spend a lot of time softening it. This is common when asking for technical help: people usually assume you'd rather they got the problem sorted as fast as possible, rather than wasting time trying not to hurt their feelings.

    Also, you evidently haven't read some of the other threads here. The number of them in which the OP has made a single, incredibly obvious mistake are astonishing.
    Yeah, I can understand that you must get ALOT of questions about really weird and/or simple stuff, so I understand why you used that approach.

    No problem, no hard feelings!

    EDIT:
    If nothing else, I'll redo some pages from scratch later this weekend, just adding some iframes with dummy texts in them trying to open up the window in other places and see what happends. Gonna redo the whole site anyway, just wanted to look how the old site would look using new techniques.

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

    Default

    If I were you, I'd stay away from iframes altogether... they're no longer supported in modern HTML or XHTML DOCTYPEs, aren't very accessible, and break various common browser features such as bookmarks and history.
    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
    Mar 2007
    Posts
    32
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey View Post
    If I were you, I'd stay away from iframes altogether... they're no longer supported in modern HTML or XHTML DOCTYPEs, aren't very accessible, and break various common browser features such as bookmarks and history.
    Ok, but if I'm not to use frames or iframes and still want a site like this:

    +--------------+
    | top |
    +---+----------+
    | m | |
    | e | main |
    | n | |
    | u | |
    +---+----------+


    Where I can choose a menu item and have it load a page into the main area without having it updating the whole page.

    This is a simplified description, but I hope you understand what I am trying to accomplish.

    There might very well be ways to design it using <table> having a specific <td> reload new information via javascript, but haven't looked into that yet, but if you are telling me that is a good solution, then I'll look into it.

    The part with it breaking bookmarks and history doesn't matter at all, but the part with "they're no longer supported" ofcourse has me worried. I don't want to make a page that wont work as it should.

    EDIT:
    Noticed that my "design" didn't look pretty even with Courier or Fixes font, but perhaps AJAX is something I should look more into to accomplish what I need? I'm a programmer since 20 years+, and been doing heavy asp/php/sql stuff the latest 5+ of those, but I've only recently had to start worrying about the actual design and output, so my HTML and webpage knowledge is limited and outdated. But I can do some really mean SQL stuff.

    EDIT 2:
    Just read up some on AJAX and it seems to be very interesting and solve a bunch of things that I want to do. So I'll delve deeper into that next week.
    Last edited by Luterin; 03-30-2007 at 04:06 PM.

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
  •