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

Thread: DHTML Window problem

  1. #1
    Join Date
    Apr 2006
    Location
    London
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation DHTML Window problem

    hi, I used a DHTML window(http://www.dynamicdrive.com/dynamici...htmlwindow.htm) on my website. The problem is, that the page on which i've placed the link to launch a DHTML window is a page which appears inside an <iframe>, so beacuse the size of the DHTML window needs to be slightly larger than the <iframe>, its sides get hidden and you cant close/control the DHTML window due to this. Changing the sizes od the <iframe> or DHTML window dosent help, as i need them to be of a specific size. I tried posting the main part of the DHTML script outside the <iframe> which i discovered, didnt work. Any idea, on how I can launch the Dhtml window OUTSIDE the <iframe> despite its launch link being INSIDE the <iframe>? I cant provide you with the actual page adress, as i'm still building the website and have not hosted it yet. please help!

    thanx


    VatsaL

  2. #2
    Join Date
    Jul 2005
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Are you launching the dhtml window using a link or does it load automatically?
    I don't know if this will work, but a simple suggestion--if you are loading with a link--would be to try to add a target to a different frame. Using the example code:
    Code:
    <a href="javascript:loadwindow('http://www.google.com',600,400)" target="main">Google</a>
    That way the link will load in "main," rather than the iframe, since the default target is something like "_self"

  3. #3
    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

    Put the script on the top (parent) page, then use for the link inside the iframe:

    HTML Code:
    <a href="javascript:parent.loadwindow('http://www.geocities.com',600,400)">Geocities</a>
    - John
    ________________________

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

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

    Default

    Ych, no.
    HTML Code:
    <a href="http://www.geocities.com" onclick="parent.loadwindow(this.href,600,400);return false;" target="_blank">Geocities</a>
    That way non-JS browsers won't barf on the link, and should even still open it in a new window.
    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!

  5. #5
    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

    Quote Originally Posted by Twey
    Ych, no.
    HTML Code:
    <a href="http://www.geocities.com" onclick="parent.loadwindow(this.href,600,400);return false;" target="_blank">Geocities</a>
    That way non-JS browsers won't barf on the link, and should even still open it in a new window.
    Well, it depends. If you want that behavior, yes. However, if the content to be displayed in the DHTML window would be better off being skipped in browsers without javascript enabled, the link example I provided (modified from the demo page's example) would be preferred.

    This could also be accomplished in better fashion:

    HTML Code:
    <a href="plain_content.htm" onclick="parent.loadwindow('enabled_content.htm',600,400);return false;" target="_blank">Link Text</a>
    Where plain_content.htm is a substitute page for non-javascript enabled browsers and enabled_content.htm is a similar page that relies heavily upon javascript.

    However, if you truly wanted nothing to happen in non-javascript enabled browsers, the original code I provided would still be the way to go.

    So, there is no reason to get so excited. Yes, there are various ways, depending upon the outcome desired.
    - John
    ________________________

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

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

    Default

    I'd disagree; if one wanted nothing to happen in non-JS browsers, it's a better idea to use "#" or even the widely-implemented "javascript:void(0);". Using javascript: may cause ugly errors if the link is selected.
    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!

  7. #7
    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

    Quote Originally Posted by Twey
    I'd disagree; if one wanted nothing to happen in non-JS browsers, it's a better idea to use "#" or even the widely-implemented "javascript:void(0);". Using javascript: may cause ugly errors if the link is selected.
    "#" is a bad idea. That will reload the page and if the link isn't in the top portion of the page, scroll the page to the top. On Geocities (and perhaps other) sites, the consequences can be even worse, see this thread. Your second idea is a good one and is very much the same as what I suggested there. However, though possible, it is highly unlikely that the javascript:parent.loadwindow('http://www.geocities.com',600,400)" will cause problems. If it would, javascript:void(0) might also.
    Last edited by jscheuer1; 04-27-2006 at 05:20 AM.
    - John
    ________________________

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

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

    Default

    Quote Originally Posted by John
    "#" is a bad idea. That will reload the page and if the link isn't in the top portion of the page, scroll the page to the top.
    Not if JS is enabled and one uses return false. On a non-JS browser, yes, it is likely to happen, but that's better than a large "Javascript not supported" error.
    However, though possible, it is highly unlikely that the javascriptarent.loadwindow('http://www.geocities.com',600,400)" will cause problems. If it would, javascript:void(0) might also.
    I'm lead to believe that javascript:void(0) is commonly recognized as "do nothing" by browsers, JS and non-JS alike. In this case, it should not cause a problem, since the Javascript is never actually executed.
    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!

  9. #9
    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

    Quote Originally Posted by Twey
    (about using "#") Not if JS is enabled and one uses return false. On a non-JS browser, yes, it is likely to happen, but that's better than a large "Javascript not supported" error.
    I know that "#" can cause problems with javascript enabled and return false. It shouldn't, but it does on some servers. That is what that thread linked to in my last post highlights. I've seen it happen other times as well. It may be a Geocities only thing and is probably due to server added scripts but, Geocities is widely used and if they do it, others could/may do it as well.

    I'm just not convinced that javascript:void(0) is that different to most browsers in non-javascript enabled mode than any other otherwise valid javascript: prefixed code used as an href. It may be, I just haven't studied it that thoroughly or run across it that much. Whenever I have, it didn't seem to present any problem.
    - John
    ________________________

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

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

    Default

    That thread would seem to illustrate a problem with return false from anchors in general, not anything specific to href="#".
    I haven't studied this thoroughly either. I shall research it in detail at a later time tonight.
    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!

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
  •