View Full Version : Popup window alignment


Elentari
05-18-2003, 05:00 PM
Ok...I am re-doing my webpage design and now I want to make my help section a popup and I am trying to get my popup window to align right in the middle of the page? I can change the measurements to align it to the middle of my page but it would look different on someone else's page because of different screen sizes and resolutions and all that so I want to make it just automatically align in the middle of all pages. (Dead center)...This is my code for the link...



<MAP NAME="image6"> <AREA SHAPE="rect" COORDS="0,0,102,32" a href="help.html" target="iframe" onClick="window.open ('/help','1932','width=640,height=480,directories=no, location=no,menubar=no,scrollbars=no, status=no,toolbar=no,resizable=no,left=0,top=0, screenx=50,screeny=50');return false" onmouseover="popup('/help; my html help site which includes teachings of CSS, HTML, DHTML and more...','#90EE90')"; onmouseout="kill()"></MAP>

Stormx
05-18-2003, 06:03 PM
try aligning it to 50% rather than 50. I don't know if it will work though

Elentari
05-18-2003, 06:18 PM
It wont because it'll align the corner to 50%.....

Stormx
05-18-2003, 07:13 PM
for width form the left try:

screen.width /2- 320

or somthing like that

or set that as a variable and load the variable as the distance from the left

Elentari
05-18-2003, 08:14 PM
Umm I have no idea what you mean.

Btw....if you are adding something to one of your posts within 5 minutes use the edit button, do not post again.

Elentari
05-19-2003, 02:33 AM
Been working at it all day and still nothing =/ Anyone have any clue pleeeeeeeeeease answer.

Stormx
05-19-2003, 05:41 AM
go use some if and else comands in the head part. Assign them as functions and load all three with your onclick event handler

Stormx
05-19-2003, 06:12 AM
go use some if and else comands in the head part. Assign them as functions and load all three with your onclick event handler.

EDIT: OK, OK, I'll write it for you. In head:

<SCRIPT LANGUAGE="JavaScript">

function popup() {

if ((screen.width == 800) && (screen.height == 600))
{window.open ('/ help','1932','width=640,height=480,directories=no, location=no,menubar=no,scrollbars=no,status=no,too lbar=no,resizable=no,left=0,top=0, screenx=80,screeny=60');}
else if ((screen.width == 1024) && (screen.height == 768))
{window.open ('/ help','1932','width=640,height=480,directories=no, location=no,menubar=no,scrollbars=no,status=no,too lbar=no,resizable=no,left=0,top=0, screenx=192,screeny=144');}
else if ((screen.width == 1280) && (screen.height == 720))
{window.open ('/ help','1932','width=640,height=480,directories=no, location=no,menubar=no,scrollbars=no,status=no,too lbar=no,resizable=no,left=0,top=0, screenx=320,screeny=120');}
else if ((screen.width == 1280) && (screen.height == 768))
{window.open ('/ help','1932','width=640,height=480,directories=no, location=no,menubar=no,scrollbars=no,status=no,too lbar=no,resizable=no,left=0,top=0, screenx=320,screeny=144');}
else if ((screen.width == 1280) && (screen.height == 960))
{window.open ('/ help','1932','width=640,height=480,directories=no, location=no,menubar=no,scrollbars=no,status=no,too lbar=no,resizable=no,left=0,top=0, screenx=320,screeny=240');}
else if ((screen.width == 1280) && (screen.height == 1024))
{window.open ('/ help','1932','width=640,height=480,directories=no, location=no,menubar=no,scrollbars=no,status=no,too lbar=no,resizable=no,left=0,top=0, screenx=320,screeny=192');}
else {alert ("You do have an odd resolution, don't you?");}
</script>



All the above goes in the head section

now change your onClick command so it looks like this:

onClick: "popup();"


As i have just spent half an ghour typing this it better work

Stormx
05-19-2003, 06:58 AM
please change where it says screeny='240' to screeny='160'