|
透明背景的开/关设置 e-mail:amxh@21cn.com ie5.5和nn6以上的浏览器支持 frame ,iframe对象的 allowtransparency 方法,如果某对象的背景颜色设置为transparency的,它将继承包含它容器的特性。
a.html如下: <html><head><title></title> b.html如下: <html><head><title></title> 如果a.html透明的,它将继承iframe的背景颜色 如果容器iframe也是透明的,a.html将继承iframe的父容器的颜色,如果一个对象不透明,它将覆盖其容器的颜色,默认是透明的。 internet explorer 5.5 以上版本允许你设置透明属性,通过设置是否可被透明,你可以改变背景的颜色。[在不设置透明属性的情况下,默认背景颜色为白色] iframe定义如下: <iframe id="frame1" src="a.html" allowtransparency="true" height=180 width=300> </iframe> <iframe id="frame2" src="b.html" allowtransparency="true" style="background-color:#459800" height=180 width=300> </iframe> 按钮定义如下: <input type="button" value="不透明" onclick="turntransparencyoff()"> <input type="button" value="透明" onclick="turntransparencyon()"> 函数turntransparencyoff(): function turntransparencyoff() 函数turntransparencyon(): function turntransparencyon() |