473,569 Members | 2,634 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="closeA ll();">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 4180
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="closeA ll();">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
19390
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 user resizes the frame to be "too narrow". Right now, the source for that frame looks like this: <table border="1" width="100%"> <tr...
3
3067
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 displayed. Can anybody know this issue and help me to resolve this. In past i received the response saying that i should download the image first...
7
6094
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 collect the pixel values as quickly as possible (like one row at a time)? what about setting (or changing) the pixel values back onto the bitmap?
4
2340
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> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html;
4
2739
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. It should put a blue and yellow box on the page with "This is a test" as part of the picture. But what I get is a broken Gif. The other problem is...
4
1966
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 this, map.GetRoute('Redmond, Washington, United States','seattle, Washington, United States',VEDistanceUnit.KiloMeter,VERouteType.Shortest);
7
2384
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 when you click a button. The button is an invisible GIF with an anchor that calls slide() onClick. The animation works fine in IE but in Firefox...
1
4910
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 order, Input field and a submit button. The Category name is being fetched from the oracle db along with the corresponding Category order. In...
2
4082
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 but cant seem to find out what the problem is. I think this could be fixed with a i.e hack??? please advise the problem of the overlapping image...
0
7701
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7615
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8130
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7677
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6284
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1223
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.