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

Thread: Control size of window

  1. #1
    Join Date
    May 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Control size of window

    Hi,
    I have one of the older navigation systems installed. It has the option of specifying a target window to open your link in. I can use "_blank" to get the link to open in a new window, but is there any way to set the size of the window that opens? Thanks.

    jjvoice

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

    Default

    Depends how old a browser we're talking here
    You need to use Javascript. The best way to do it is:
    Code:
    <a href="page.html" target="_blank" onclick="window.open(this.href, '', 'width=400,height=400');return false;">Link Text</a>
    I wouldn't advise setting a size bigger than 640x480.
    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
    May 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    Thanks for the reply. I know how to do this if I was coding it myself. The problem is that you have to use the custom.js file of the script to set your links. Here is the line for setting up a sub-menu item:

    addSubmenuItem("url","\title","_blank","");

    I can put "_blank" in the third parameter and it opens in a new window, but I see no way of setting the size of the window that opens. I got thi script from DynamicDrive a number of years ago and no longer have the documentation and don't see it on their page anymore. Was just wondering if someone had any ideas that would work. Thanks.

    jjvoice

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

    Default

    Unfortunately, without the full code, I can't help you. If the script is that old, it's likely that there's a newer replacement available on DD.
    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

    This looks like a variation on HV Menu or Jim's DHTML Menu v5.7, either of which can now accept:

    Code:
    addSubmenuItem("javascript:window.open('http://www.google.com', '_blank', 'width=400,height=400');","\title","","");
    in their link or url field.

    Your script may not in fact be one that can do this but, many of these type menu scripts have this capability built in. If this won't work for yours, consider trying one of the above linked menus that your code resembles.
    - John
    ________________________

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

  6. #6
    Join Date
    May 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    John,

    Thanks for the reply. I tried that and it worked great, except for one problem. It did open the window with the size I specified, but instead of just leaving the original page as is, where I could close the new window and be on the original page, it opened the new window, and changed the original page to a blank page with just "[object]" in the upper lefthand corner of the page. Any idea why that happened? Thanks.

    Bob

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

    Default

    Any idea why that happened?
    The page is displaying the return value of the window.open() call. Try:
    Code:
    javascript:void(window.open('http://www.google.com', '_blank', 'width=400,height=400'));
    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
    May 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    John,

    That worked great! Thanks!

    Bob

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

    Default

    I'm not John.
    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
    May 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Twey,

    Oops, sorry - looked to fast - thought it was John responding again. Thanks, Twey - it worked great!

    Bob

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
  •