Advertisement

09.19.2008 at 10:01AM PDT, ID: 23746595 | Points: 500
[x]
Attachment Details

DOM Image properties

Asked by chappymcgee in Dynamic HTML (DHTML), JavaScript

Tags: ,

I am writing a little javascript snippet that reads through all the image tags on a page and then overlays a div on them.

I am grabbing the image height and width properties to set the div height and width.  The issue I am having is with a tabbed area.  A div that is hidden/unhidden depending on a clicked link.  I am unable to get the properties of images inside the hidden div.  My code finds the img object, but not the properties associated with it.

Code:
        myBodyElements = myBody.getElementsByTagName("img");
      for (i=0; i<=myBodyElements.length-1; i++)
      {
                   myP = myBodyElements[i];
           img_height=myP.Height;  <--returns 0 for the hidden div.
           img_width=myP.Width;  <--returns 0 for the hidden div.
      }Start Free Trial
[+][-]09.19.2008 at 11:33AM PDT, ID: 22524026

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.19.2008 at 12:10PM PDT, ID: 22524356

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.19.2008 at 12:22PM PDT, ID: 22524497

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.19.2008 at 12:32PM PDT, ID: 22524643

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.19.2008 at 12:39PM PDT, ID: 22524733

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628