0

我有一个位于indexflash.html中的 iframe main ,其中包含html 文档indexflash2.html,其中包含两个框架topframe(加载 main.html)和bottomframe(加载 home.html)。topframe和bottomframe都有scrolling ="no"

topframe保存 Flash 导航控件 bottomframe更新与要显示的内容

我希望能够用鼠标滚轮控制main的滚动条,这样你就可以无缝地滚动整个页面作为一个单元。现在,我猜测焦点会落在顶部框架底部框架上,因为当您尝试使用滚轮时,鼠标指针所在的位置。

我正在处理的页面可以在http://96.9.39.101/indexflash.html看到

如何强制鼠标滚轮始终控制父 iframe main的滚动条,而不管其中包含哪些框架或 iframe?

我确定这将需要一些 javascript,但我对 JS 还不够熟悉,无法单独解决这个问题。

indexflash.html:

<iframe name="main" src="indexflash2.html" width="100%" height=2505></iframe>

indexflash2.html:

<frameset framespacing="0" border="0" frameborder="0" rows="400,*">
<frame name="topFrame" height="400" scrolling="no" noresize target="bottomFrame" src="main.html">
<frame name="bottomFrame" height="2105" target="_self" scrolling="no" src="home.html">
<noframes>
</frameset>
4

1 回答 1

1

您可以使用onscroll 事件来同步两个帧。

编辑- 该网站在 Chrome 中对我来说运行良好,滚动没有什么奇怪的。不过,IE 并没有那么好用。我不确定我的想法是否可行。

<script type="text/javascript">
document.onscroll = function() {
    parent.b.document.body.scrollTop = document.body.scrollTop;
}
</script>

会将名称为 b 的框架与滚动框架同步,但这可能不是您所需要的。

于 2009-05-18T18:31:10.470 回答