iframe隐藏html元素

html-css09

iframe隐藏html元素,第1张

iframe html :

<iframe name="processResultMsg" width="100%" height="65%"

id="processResultMsg" src="/${msgPath}" frameborder="no"

scrolling="no" style="overflow: hidden">您的浏览器不支持iframe,请升级</iframe>

子页面中要隐藏的标签:

<div class="formBar" >

......blabla......

</div>

javascript:

$('#processResultMsg').load(function() {

$(window.frames["processResultMsg"].document).find(".formBar").hide()

})

很重要的一点就是$('#processResultMsg').load(function() {})

就是说一定要在iframe加载完之后才能执行js方法

不然就会报获取不到元素的错误

html设置元素不可见的方法:1、在元素标签中添加hidden属性。

2、在元素标签中使用style属性设置“display:none”样式。

3、在元素标签中使用style属性设置“visibility:hidden”样式。

html中使元素不可见有三种方法:

使用hidden属性。

使用style属性设置display:none。

使用style属性设置visibility:false。

显然,使元素不可见有两类方式:

元素彻底不可见,元素不会占据空间,仿佛消失了一样。

元素不可见,但是依旧占据着原来的空间,仿佛隐形了一样。