473,492 Members | 4,279 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

window.open gives excess image padding in IE6

Hi,

I have a simple script that opens an image in a new window which is sized to
the image. The script is as follows: <a title="xxx"
onclick="window.open('http://www.[sitename].com/photos/xxx.jpg','height=xxx,
width=xxx');return false" href="#">link text</a>

This script works very well for my needs, however, in IE6, the resulting
opened window has unnecessary padding on the top and left sides of the
image, which pushes the image down and to the right inside the window. The
window is not resizable, and some of the image is therefore cropped. I don't
notice this with Safari or Camino. Is this a bug in IE? Is there a way to
compensate for this extra padding in IE? Is there a more elegant way of
executing this script to avoid the problem altogether?

I would appreciate any advice.

Cheers,
Beck
Jul 23 '05 #1
3 3358
Becky Carter Hickman-Jones wrote:
Hi,

I have a simple script that opens an image in a new window which is sized to
the image. The script is as follows: <a title="xxx"
onclick="window.open('http://www.[sitename].com/photos/xxx.jpg','height=xxx,
width=xxx');return false" href="#">link text</a>

This script works very well for my needs, however, in IE6, the resulting
opened window has unnecessary padding on the top and left sides of the
image, which pushes the image down and to the right inside the window. The
window is not resizable, and some of the image is therefore cropped. I don't
notice this with Safari or Camino. Is this a bug in IE? Is there a way to
compensate for this extra padding in IE? Is there a more elegant way of
executing this script to avoid the problem altogether?

I would appreciate any advice.

Cheers,
Beck


Microsoft Internet Explorer includes the default "margin" style attributes, even
on pages that are loaded as a .jpg. If you want to avoid this, load a .html file
that embeds the image you want to display and includes:

<style type="text/css">
body { margin: 0px; }
</style>

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 23 '05 #2
"Grant Wagner" <gw*****@agricoreunited.com> wrote in message
news:40***************@agricoreunited.com...
Becky Carter Hickman-Jones wrote:

I have a simple script that opens an image in a new window which is sized to the image. The script is as follows: <a title="xxx"
onclick="window.open('http://www.[sitename].com/photos/xxx.jpg','height=xxx, width=xxx');return false" href="#">link text</a>

This script works very well for my needs, however, in IE6, the resulting
opened window has unnecessary padding on the top and left sides of the
image, which pushes the image down and to the right inside the window. The window is not resizable, and some of the image is therefore cropped. I don't notice this with Safari or Camino. Is this a bug in IE? Is there a way to compensate for this extra padding in IE? Is there a more elegant way of
executing this script to avoid the problem altogether?

I would appreciate any advice.

Cheers,
Beck
Microsoft Internet Explorer includes the default "margin" style

attributes, even on pages that are loaded as a .jpg. If you want to avoid this, load a ..html file that embeds the image you want to display and includes:

<style type="text/css">
body { margin: 0px; }
</style>

--
| Grant Wagner <gw*****@agricoreunited.com>

Thank you for the tip. I use this script on a blog, and this blog often has
pictures that I want to show off. So, your tip would mean that I have to
create a brand new html page for every picture that I want to show? I'm
still new to this, so I appreciate your patience.

Beck
Jul 23 '05 #3
Becky Carter Hickman-Jones wrote:
"Grant Wagner" <gw*****@agricoreunited.com> wrote in message
news:40***************@agricoreunited.com...


<--snip-->
Microsoft Internet Explorer includes the default "margin" style
attributes, even on pages that are loaded as a .jpg. If you want
to avoid this, load a ..html file that embeds the image you want to
display and includes:

<style type="text/css">
body { margin: 0px; }
</style>


Thank you for the tip. I use this script on a blog, and this blog often has
pictures that I want to show off. So, your tip would mean that I have to
create a brand new html page for every picture that I want to show? I'm
still new to this, so I appreciate your patience.


<a href="URLToImage" onclick="window.open('blank.html?' +
(this.href.substring(this.href.lastIndexOf('/')+1,this.href.length)));return
false"><img src="URLToImage" width="##" height........></a>

Wrap that around each image. Then, in imagePage.html, have script that
will read the query string and display the appropriate image, along with
the styles that you need:

<script type="text/javascript">
document.write('<img src="' +
location.search.substring(1,location.search.length )) + ' rest of img tag
here>'

</script>

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3959
by: Mika | last post by:
Hi, I'm trying to use the following code which should open a popup window. It doesn't work with Opera 5. Netscape 4.x opens a window in wrong size. IE 5.5, Netscape 7.0 and Opera 7.11 are ok. ...
3
5161
by: Steve | last post by:
Hi, I have a nice little script that works well displaying images on my website. It's a script where if you clik a thumbnail image a pop up window opens that contains a larger version of the same...
7
1660
by: Jonathan | last post by:
Hi I open a new window using a javascript function: function nw(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } which I call thus:
2
1380
by: MM | last post by:
I am using the following code to display an image in a seperate window. <form> <input type=button onClick='window.open("image1.jpg","","width=260,height=260,resizable=0,border=0")' value=Shhow...
14
11016
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
0
1048
by: phil-news-nospam | last post by:
I was experimenting with buttons in HTML/CSS and encountered some strange behaviour when changing the padding property setting in the stylesheet. Maybe it's not a stylesheet issue, but since that's...
5
18173
by: TurboRogue | last post by:
So here's the basic premise: I have an html page with a bunch of pictures (pic.html). All of the images are thumbnails of larger photos. I also have another html page which is a pop-up window...
3
1413
by: mylog | last post by:
I have a problem regarding open the enlarged image in a new window. What I am facing problem is I have to open put the image in the div from Javascript which I have done well and now what I need is...
2
3214
by: wreed06 | last post by:
Hello, I have 2 problems. In my webpage, I have a dropdown list with a button that takes the user to a popup window specific to the option. I am using Firefox 2.0.0.13. I have successfully...
0
6980
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7192
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6862
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7364
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5452
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
282
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.