我已经附上了演示问题的示例代码.我正在Firefox 3.5.7中进行检查.问题是父HTML具有滚动条,并且它加载了全屏iframe(高度:100%,宽度:100%),我希望在加载iframe后删除父滚动条.
1)这可能吗?
2)当我们给出高度时:100%;宽度:100%为什么只占据视野?但不是
父母的全部居住区?
This is Main.html
<Html>
<head>
<script type="text/javascript" src="client.js"></script>
<title>
I am a client
</title>
</head>
<body bgcolor="#000000">
You can see the iframe below...
You can see the iframe below...
You can see the iframe below...<br><br>
<br><br><br><br><br><br>
<br><br><br><br><br><br>
<br><br><br><br><br><br>
<br><br><br><br><br><br>
<br><br><br><br><br><br><br>
<br><br><br><br><br><br>
You can see the iframe below...
<br>
<iframe name="clientframe" id = "clientframe" src = "app.html" style="position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:999;background:#ff0000"
onload = "sendparams();" frameborder="no">
</iframe>
</body>
</html>
This is app.html:
<HTML>
<HEAD>
<title>
I am an Application
</title>
</HEAD>
<BODY>
<h3>This is an application</h3>
<br>
You name <input type="textBox"> <br>
Password <input type="password"><br>
<br>
<br>
<input type="button" value ="Let me in">
</BODY>
</HTML>
注意:打开Main.html,它将在iframe中加载app.html.您会注意到,在加载iframe后,会出现滚动条,并且iframe的红色背景不会完全填满整个父对象.
最佳答案
加载iframe时隐藏“父”窗口滚动条
将此脚本放在Main.html顶部
<script type="text/javascript">
function sendparams() {
document.body.style.overflow = "hidden";
}
</script>