473,508 Members | 2,303 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting hidden image width/height in IE

epots9
1,351 Recognized Expert Top Contributor
I have a image inside of a div
[html]
<div id="image">
<div id="loader">
<img id="loaderImage" src="assets/loader.gif" alt="loading..." />
</div>
<div id="loaded">
<img id="picture" src="" alt="" /><!--image in question-->
<div id="closeAll" onclick="closeAll();">X</div>
</div>
</div>
[/html]

the div "image" is hidden until a button is click, and the div "loaded" is hidden until a certain time.

the javascript in question:
Expand|Select|Wrap|Line Numbers
  1. var image = document.getElementById("image").style;
  2. var width = document.getElementById("picture").width;
  3. var height = document.getElementById("picture").height;
  4. document.getElementById("picture").style.width = width + "px";
  5. document.getElementById("picture").style.height = height + "px";
  6. height += 15;
  7. image.display = "block";
  8. image.width = width + "px";
  9. image.height = height + "px";
  10.  
the problem is that in ie7 width and height return zero causing the div "image" to be 0x0....but in firefox width and height return the correct values and the div is sized correctly. so, i'm looking for a work around.

thanks in advance..
Aug 5 '07 #1
1 4173
epots9
1,351 Recognized Expert Top Contributor
I have a image inside of a div
[html]
<div id="image">
<div id="loader">
<img id="loaderImage" src="assets/loader.gif" alt="loading..." />
</div>
<div id="loaded">
<img id="picture" src="" alt="" /><!--image in question-->
<div id="closeAll" onclick="closeAll();">X</div>
</div>
</div>
[/html]

the div "image" is hidden until a button is click, and the div "loaded" is hidden until a certain time.

the javascript in question:
Expand|Select|Wrap|Line Numbers
  1. var image = document.getElementById("image").style;
  2. var width = document.getElementById("picture").width;
  3. var height = document.getElementById("picture").height;
  4. document.getElementById("picture").style.width = width + "px";
  5. document.getElementById("picture").style.height = height + "px";
  6. height += 15;
  7. image.display = "block";
  8. image.width = width + "px";
  9. image.height = height + "px";
  10.  
the problem is that in ie7 width and height return zero causing the div "image" to be 0x0....but in firefox width and height return the correct values and the div is sized correctly. so, i'm looking for a work around.

thanks in advance..
never mind, i solved it.

all i had to do was relocate the javascript to after i make the div visible and width and height were returning the correct values (working with ie7 and firefox).
Aug 5 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
19380
by: Kai Grossjohann | last post by:
I have a frame which is supposed to contain a list of links. The clickable area of each link comprises a picture followed by some text. I want the text to be cut at the right hand side when the...
3
3055
by: Hitesh | last post by:
Hi, I am getting the response from another Website by using the HttpHandler in my current site. I am getting the page but all the images on that page are not appearing only placeholder are...
7
6085
by: chuck | last post by:
I load a bitmap using GDI+ now, I want to collect all the pixel values, (in RGB but without the A component) onto a color array, say... dim btmp1(,) as color is there a method that can help me...
4
2329
by: reikoshea | last post by:
okay ive been working at this for probably 4 hours now, and I (not to mention my boss) am pretty upset. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head>...
4
2736
by: tshad | last post by:
I am trying to set up an Image authorization where you type in the value that is in a picture to log on to our site. I found a program that is supposed to do it, but it doesn't seem to work. ...
4
1960
windows_mss
by: windows_mss | last post by:
When I Select Source & Destination Dynamically, Path Getting Scatter Across The Map... hi, i can able to get the Correct Route and Path for the corresponding Source and destination, like...
7
2381
by: raylaur | last post by:
I'm using a javascript "slide" function to move a <div> layer in 10 pixel increments from one location on a page to another. The layer contains a GIF image. It's basically a side panel that flies out...
1
4899
by: raghuvendra | last post by:
Hi I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button. All these are aligned in a row. And Each Category Name has its corresponding Category...
2
4079
by: studentofknowledge | last post by:
For some unknown reason ie is placing images I have in a div in a weird way. One image is overlapping another but this problem is not occuring in mozilla. I have looked at my code over and over again...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7324
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
7382
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...
0
7495
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
4707
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
3193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3181
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1556
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.