js如何设置在iframe框架中指定div不显示
js如何设置在iframe框架中指定div不显示
发布时间:2016-12-30 来源:查字典编辑
摘要:复制代码代码如下:测试functiongetStyle(){if(window.top==window.self){document.get...

复制代码 代码如下:

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>测试</title>

<script language="javascript" type="text/javascript">

function getStyle() {

if (window.top == window.self) {

document.getElementById("top").style.display = 'block';

} else {

document.getElementById("top").style.display = 'none';

}

}

</script>

</head>

<body onload="getStyle();">

<form id="form1" runat="server">

<div id="top">

在框架中不显示,正常访问显示

</div>

</form>

</body>

</html>

当当前页面正常访问时显示div top

当当前页面在iframe中时页面不显示 div top

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新Javascript教程学习
热门Javascript教程学习
编程开发子分类