how to get div dimensions in IE

  • Thread starter Miquel Escarrà
  • Start date
M

Miquel Escarrà

Hi,

I want to have an image inside a div section, like a background image. that
adjust its size to the dimensions of div container:

<body onload="adjustlogo()>
<div class="logo" id "logot">
<img src="logo.png" id="imagelogo">
</div>


a script function retreives the div section:

oLogo = document.getElementById("logot")

but oLogo.clientWidth gets the logo.png's width instead of the div area.

I have no problems with a similar function in mozilla browser,
any idea for IE?

Miquel
 
M

Matthew Van Gundy

Miquel said:
Hi,

I want to have an image inside a div section, like a background image. that
adjust its size to the dimensions of div container:

Have you tried using CSS instead? As in:
<div class="logo" id="logot" style="background: url(logo.png);"></div>
 
M

Miquel Escarrà

Have you tried using CSS instead? As in:
<div class="logo" id="logot" style="background: url(logo.png);"></div>

What I want is a bit more complex: logo is an image witht its own dimensions.
if it is a background image, only a part of it is visible. If the user reduces
the browser client window, it doesn't resize.

By my way, I can get logo's dimensions controled by the window.onResize event.

Thank you.

Miquel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,162
Latest member
GertrudeMa
Top