Transparent IFrames in Internet Explorer using Javascript

June 10, 2008 – 8:04 pm

In order to have an IFrame with a transparent background in Internet Explorer, you need to add an “allowtransparency” attribute, like so:

<iframe src="iframe_source.html" id="iframe_id" allowtransparency="true" />

However, if you want to set the transparency with Javascript via the DOM, you must camelCase the property:

document.getElementById('iframe_id').allowTransparency = true;

Note - you must also make sure that <body> tag in the document contained by the iframe is also transparent in order for the parent’s colours to show through.

  1. 1 Trackback(s)

  2. Jun 10, 2008: Transparent IFrames in Internet Explorer using Javascript

Post a Comment