Centered Popup

liunx

Guest
I have a product that when you click it launches a centered javascript popup to show the enlarged product but there still seem to be space (about 1/4") on top and side. I have tried to set all page properties, margins to 0. Still get the space. I am using dreamweaver MX on a Mac. Any ideas on this?<br />
<br />
Thank you. <br />
<br />
Doug<!--content-->if it is an object, you could use:style="position:absolute;top:0;left:0"<!--content-->You could also do something like putting the enlarged pic in a <div>, style that div with CSS to put it behind everything else, then onclick="whatever_you_name_said_div.style.z-index = 10"... that is if you know CSS... just a thought<!--content-->2 thoughts:<br />
<br />
1. Are you sure that margin isn't part of the image itself?<br />
2. What about adding corresponding margins around the rest of the image, so it looks nicely centered in the popup window?<!--content-->I am experiencing the same problem as doug234. My image doesn't have any white spaced margins, but when i include it in the popup window, i get space on the top and left side. Is there a way to align the image to the top left?<!--content-->Originally posted by steelersfan88<br />
style="position:absolute;top:0;left:0"<!--content-->Thanks Steelerfan88, but that code doesn't seem to work for me. I create a simple onload popup window using javascript and when the window opens, my image is off center. There is 1/4 space on top and to the left side of the image. The image itself is only 300 x 200. And it doesn't have any extra space. I've been looking for some code that would resize the window to the image size. Do you have any suggestions?<!--content-->Why don't you post the popup code? Maybe there's something there.<!--content-->function popUp(URL) {<br />
day = new Date();<br />
id = day.getTime();<br />
eval("page" + id + " = window.open(URL '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,width=300,height=200')");<br />
}<br />
// End --><br />
</script><br />
</head><br />
<br />
<BODY onLoad="javascript:popUp('images/GameEvent.html')"><br />
<br />
etc...<!--content--><head><br />
<script type="text/javascript"><br />
<br />
function popUp(URL) { <br />
day = new Date(); <br />
id = day.getTime(); <br />
var newWin = window.open('', '"+ id +"', config='toolbar=0,scrollbars=0,location=0,statusbar=0,men<br />
ubar=0,width=300,height=200')<br />
newWin.document.write('<img src=http://www.webdeveloper.com/forum/archive/index.php/"'+ URL +'" height=300, width=200 tyle="position:absolute;top:0;left:0">')<br />
newWin.document.close()<br />
} <br />
<br />
</script> <br />
</head> <br />
<br />
<BODY onLoad="popUp('images/GameEvent.html')">...That should work!<!--content-->Thanks for the code Steelersfan88. I think my problem maybe because, I'm creating this in Frontpage. I inserted the code you gave me, but I'm still having problems.<!--content-->Originally posted by ljmclaug <br />
Thanks Steelerfan88, but that code doesn't seem to work for me. I create a simple onload popup window using javascript and when the window opens, my image is off center. There is 1/4 space on top and to the left side of the image. The image itself is only 300 x 200. And it doesn't have any extra space. I've been looking for some code that would resize the window to the image size. Do you have any suggestions? <br />
It's the default padding/margin applied to the <body> of the opened window. Using Steeler's solution would be more logical than set the <body> margin/padding to zero.<!--content-->Thanks Paul, Frontpage often creates problems with copying < and > characters, commonly replacing them with &lt and &gt, respectively. Is the code the same that I posted that appears when pasting in frontpage?<!--content-->i also noticed something ... the code you have actually opens a HTML file; what is contained on this file?<br />
<br />
If this file contains the picturel you can simply add those style properties to that picture and forget the code I previously posted.<!--content-->Yes, the code is exactly as you have posted. I have had ample experience with the &gt and &lt problem frontpage has with coping. <br />
<br />
Also, the image is the only thing on the html page. Would it be better if I just point to the actual gif image?<!--content-->yes, in the parenthesis of the popUp(...), put the source of the image, not the HTML page. Then it should work!<!--content-->
 
Back
Top