Retrieving CSS values from parent (IE problem)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cwroblew
    New Member
    • Dec 2007
    • 2

    Retrieving CSS values from parent (IE problem)

    I am using an Iframe to include an html file that changes about 5 times a day. The background color is not white which causes a problem with IE because IE puts a white box around my Iframe. Firefox and Safari don't and since more people seem to use IE I need to make it work for IE.

    I want to read the CSS background-color for the Iframe so I can dynamically change the body background color for the Iframe file. This file can be used in 30+ pages that have different background colors containing the Iframe.

    This is the code around the Iframe:

    Code:
    <td align="center" valign="top" class="classswithbackgroundcolor">
      <table width="98%" border="0" cellspacing="0" cellpadding="0">
        <tr id="iframeid">
          <td width="100%" valign="top" align="center">
            <iframe name="I1" src="http://domain.com/fileusedbymanypages.htm" frameborder="0" style="height: 100%" width="100%" border="0"></iframe>
          </td>
        </tr>
      </table>
    </td>
    I have seen lots of code to change the background color, but I haven't found any to determine the background color of the class: classswithbackg roundcolor especially since we're dealing with a parent.

    The CSS:

    For index1.htm:

    Code:
    .classswithbackgroundcolor{
        background-color:#bbbbbb;
    }
    For index2.htm:

    Code:
    .classswithbackgroundcolor{
        background-color:#d5d5d5;
    }
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    See if this link helps.

    Comment

    • cwroblew
      New Member
      • Dec 2007
      • 2

      #3
      Originally posted by acoder
      See if this link helps.
      It might, but I am using prototype's getElementsByCl assName because I need the style of a class not an id.

      I'm having trouble converting it (partly because I don't quite understand prototype.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        You may need to declare the background color with the rgb notation. In IE, use the JavaScript camel-case, i.e. backgroundColor .

        Comment

        Working...