Forum Moderators: open

Message Too Old, No Replies

Open popup in fixed page position

         

limbo

2:49 pm on May 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Was hoping someone might know if you can fix the position of a popup on the screen.

I want the popup window(s) to open at fixed points so 2 will align down the length of the screen, not overlap, and will always position themselves exactly. EG X 100 : Y 100

Is there a scrap of code I can add to simple popup javascript to action this?

Many thanks

Limbo

Condor12

2:59 pm on May 15, 2003 (gmt 0)

10+ Year Member



Hi Limbo,

Try something like this;

thiswindow=window.open([usual stuff]);
thiswindow.moveTo((screen.width-widthis)/2,(screen.height-heightis)/2);

Use the moveTo to change the position, I use this to center the window.

You can use this to open the first window then again to open the second, but change the second moveTo function to take into account the first windows width and height, i.e.

thiswindow1.moveTo(x1,y1)
thiswindow2.moveTo((x1+window1width),(y1+window1height))

Paul in South Africa

3:04 pm on May 15, 2003 (gmt 0)

10+ Year Member



window.open("http://www.domain.com", "", "fullscreen=no,toolbar=yes,status=yes,
menubar=yes,scrollbars=yes,resizable=yes,directories=yes,
location=yes,width=500,height=400,left=100,top=100")

should work. Just change width, height, left and top values to suit.

tedster

4:51 pm on May 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The window positioning portions of the features string for window.open are not standardized. While Explorer uses left= and top= (as in the above code) Netscape uses screenX= and screenY=.

So for cross-browser code, you need to include both sets of feature declarations.

limbo

9:56 am on May 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks all

Works exactly as I imagined

Tedster >> The window positioning portions of the features string for window.open are not standardized. While Explorer uses left= and top= (as in the above code) Netscape uses screenX= and screenY=.

Is this what you meant? ;

<script>
function openpopup(){
winpops=window.open("http://www.google.com","","fullscreen=no,toolbar=yes,status=yes,
menubar=yes,scrollbars=yes,resizable=yes,directories=yes,location=yes,
width=500,height=400,left=100,top=100,screenX=100,screenY=100")
}
</script>

Ta

Limbo

limbo

10:59 am on May 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmmnnn?

I was hoping that I could use popupwindows to create a '4 window mosiac' that would work well for a page <toolbox?> we are experimenting with.

I was hoping the javascript for each window would open paralell to oneanother but it seems the lower javascript call is overiding the others above it.

Can anybody help, please. script below

<script>
function openpopup(){
winpops=window.open("http://www.google.com","","fullscreen=no,toolbar=no,status=no,
menubar=no,scrollbars=no,resizable=no,width=100,height=100,left=100,top=100,screenX=100,screenY=100")
}
</script>
<a href="javascript: openpopup()" title="click to open POPUP">FIXED WINDOW POSITION
POPUP1</a>
<script>
function openpopup(){
winpops=window.open("http://www.google.com","","fullscreen=no,toolbar=no,status=no,
menubar=no,scrollbars=no,resizable=no,width=100,height=100,left=200,top=100,screenX=200,screenY=100")
}
</script>
<a href="javascript: openpopup()" title="click to open POPUP">FIXED WINDOW POSITION
POPUP2</a>

Ta

Liam

DrDoc

11:08 am on May 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just name the second one openpopup2() or something (remember to change both function name and the link)

BlobFisk

11:09 am on May 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



... and the x and y coordinates.

limbo

11:20 am on May 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Aha!

Merci buckets!