Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pop-up window

Status
Not open for further replies.

angy

Technical User
Mar 24, 2003
12
US
Is there a way to align the contents in the pop-up window?

My window opens a jpg photo. My pop-up window size is the exact same size as the photo it opens.

Problem is that there is white space above and to the left because the photo is not aligned top left properly. it looks bad. how can i fix this?

thanks for all help.

my code follows:
<script>
function popup(){
win=window.open(&quot;photoA.jpg&quot;,&quot;Interiors&quot;,&quot;resizable,scrollbars,toolbar, width=950,height=750&quot;)
}
</script>


<a href=&quot;javascript:popup()&quot;>PhotoA</a>
 
hi angy,

The reason is that there's always white space between left and top borders and document content by default. In order to set it to zero you must use common html properties of the <body> tag. You may do it like this:

function popup(){
win=window.open(&quot;&quot;,&quot;Interiors&quot;,&quot;resizable,scrollbars,toolbar, width=950,height=750&quot;);
win.document.open();
win.document.write('<html><body marginheight=&quot;0&quot; marginwidth=&quot;0&quot; leftmargin=&quot;0&quot; topmargin=&quot;0&quot;>');
win.document.write('<img src=photoA.jpg width=&quot;&quot; height=&quot;&quot; alt=&quot;&quot;>');
win.document.close();
}
 
thanks so much..i'm going to try it out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top