Results 1 to 2 of 2

Thread: Control window size of popups (all links)

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

    Default Control window size of popups (all links)

    1) Script Title:
    Open select links in new window

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

    3) Describe problem:
    I think this code is great - is there a way to set all the new popups to open at a specific size, rather than a full browser window?

    thanks in advance.

  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

    Use this (additions red) in place of the script's current function applywindow():

    Code:
    function applywindow(){
    if (typeof targetlinks=="undefined") return
    if (!formcache || (formcache && formcache.targetnew.checked)){
    for (var i=0; i<=(targetlinks.length-1); i++){
    targetlinks[i].target=linktarget
    targetlinks[i].onclick=function(){window.open(this.href, this.target, 'width=300, height=250, resizable, scrollbars');return false;};
    }
    }
    else
    for (var i=0; i<=(targetlinks.length-1); i++)
    targetlinks[i].target=""
    }
    In this added line:

    Code:
    targetlinks[i].onclick=function(){window.open(this.href, this.target, 'width=300, height=250, resizable, scrollbars');return false;};
    you can set the width and height to whatever you like. Don't make the values too big or too small as, folks have all sorts of different sized screens out there.
    - John
    ________________________

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

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
  •