Click to See Complete Forum and Search --> : window.open problem


Count_Rugen
02-18-2003, 05:06 PM
I am an inexperienced javascript user, and am seeking assistance with opening new windows when clicking on an image. I want the new window to open to the size of the picture, which it does, however, the picture is offset approximately 10 pixels or so from the top, therefore, some of the image is cut off. I am using Windows XP and IE6.

I am using the following code to open the window.
<A HREF="#" onclick="javascript:location='view.php?id=4'; window.open('images/picture.jpg', 'image_window', 'HEIGHT=240, WIDTH=240, top=100, left=100, scrollbars=no')">

what do i have to do to make sure the picture is not offset at all?

gil davis
02-18-2003, 05:24 PM
There are margins in a window with no styles. When you open a window a certain size, the function does not account for margins. You could just add a constant to the width and height to compensate.

Count_Rugen
02-18-2003, 08:57 PM
so how am i able to open a window with styles, so i can set the margin to 0?

gil davis
02-19-2003, 05:51 AM
so how am i able to open a window with styles, so i can set the margin to 0?You can't. What I was suggesting was to make the window bigger.

If you were to use document.write() and construct some HTML in the new window, you could accomplish what you want. You could take a look at http://gil.davis.home.att.net/shuttle4.htm and see what I did.

Or, you could create separate HTML files and load that.