PDA

View Full Version : Control window size of popups (all links)



adina
10-13-2006, 12:15 PM
1) Script Title:
Open select links in new window

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex8/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.

jscheuer1
10-14-2006, 07:46 AM
Use this (additions red) in place of the script's current function applywindow():


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:


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.