all
alt
ch
dir
id
min
rel
top
url
URL
urn
Expand Minimize

allowtransparency attribute | allowTransparency property

Sets or retrieves whether the object can be transparent.

Syntax

HTML<element allowtransparency="p" ... >
JavaScript

p = object.allowTransparency

Property values

Type: Boolean

false (false)

Default. Object is opaque. It cannot be transparent.

true (true)

Object can be transparent.

Standards information

There are no standards that apply here.

Remarks

When the property is set to VARIANT_FALSE, the backgroundColor property of the object can only be that of the window. When the property is set to VARIANT_TRUE, the backgroundColor property of the object can be set to any value, including the default value of transparent.

Examples

The following example shows four ways to use the allowTransparency attribute, with and without the background-color attribute. Because the allowTransparency attribute of Frame1 is set to true, Frame1 renders red, the background color of the parent document. The allowTransparency attribute of Frame2 is also set to true, however the background-color attribute of Frame2 is set to green, so Frame2 renders green. Because the allowTransparency attribute of Frame3 is set to false (the default value), Frame3 renders white, the color of the src document. The allowTransparency attribute of Frame4 is also set to false, so Frame4 renders white even though the background-color attribute of Frame4 is set to green.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/allowTransparency.htm


<body style="background-color: red">
<iframe id="Frame1" src="transparentBody.htm" allowTransparency="true">
</iframe>
<iframe id="Frame2" src="transparentBody.htm" allowTransparency="true"
  style="background-color: green">
</iframe>
<iframe id="Frame3" src="transparentBody.htm">
</iframe>
<iframe id="Frame4" src="transparentBody.htm"
  style="background-color: green">
</iframe>				
</body>


See also

frame
iframe

 

 

Show:
© 2014 Microsoft