先简单说一下,就是我有一个a.aspx页面包含一个iframe,iframe连接到b.aspx页面,b.aspx页面包含一个frameset,frameset指向fa.aspx和fb.aspx两个页面,滚动条都被我设置了no了,高度我也搞定自动高度了,所以整个页面只有一个垂直滚动条,问题就是当鼠标在fa.aspx和fb.aspx页面里面的时候不管怎么滚动滚轮,垂直滚动条都不动,只有当鼠标离开这两个页面到外面一层的页面里面使用滚轮才行。下面是具体情况。页面Default.aspx里面包含三个iframe
<body>
<form id="form1" runat="server">
<div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<iframe runat="server" id="TopIframe" height="115" src="Top.aspx" scrolling="no" width="774" frameborder="0"></iframe>
</td>
</tr>
<tr>
<td>
<iframe runat="server" id="MiddleIframe" src="Middle.aspx" scrolling="no" width="774" frameborder="0"></iframe>
</td>
</tr>
<tr>
<td>
<iframe id="BottomIframe" src="Bottom.aspx" width="100%" scrolling="no" frameborder="0"></iframe>
</td>
</tr>
</table>
</div>
</form>
</body>
页面Middle.aspx里面又包含有frameset,外面一个frameset是用来做自动高度的,里面一个是真正包含内容的
<noframes>您的浏览器不支持框架</noframes>
<frameset id="LayoutFrameset" rows="0,*" frameborder="0" framespacing="0">
<frame id="LayoutTop" src="#" noresize="noresize" />
<frameset id="pMainFrameset" frameborder="0" framespacing="0" cols="158,616">
<frame id="pleft" name="pleft" scrolling="no" noresize="noresize" src="Left.aspx?wNO=<%=WebNO()%>" />
<frame id="pmain" name="pmain" scrolling="no" noresize="noresize" src="Main.aspx?wNO=<%=WebNO()%>" allowtransparency="true" runat="server" />
</frameset>
</frameset>
在Main.aspx页面我已经搞定了高度的自动变化
<script type="text/javascript">
window.onload=function()
{
if(window.document.body.scrollHeight<680)
{
window.parent.document.all("LayoutFrameset").rows="0,680";
window.parent.parent.document.all('MiddleIframe').height=680;
}
else
{
window.parent.document.all("LayoutFrameset").rows="0,"+window.document.body.scrollHeight;
window.parent.parent.document.all('MiddleIframe').height=window.document.body.scrollHeight;
}
}
</script>
我的问题是:在Default.aspx页里面在iframe外面才可以使用滚轮控制滚动条,而鼠标移动到iframe里面的frameset里面的无论是left.aspx或者Main.aspx页的时候,不管怎么滚动滚轮,滚动条都不动,让人非常难过,一定要把鼠标移动到iframe(frameset)外面来才起作用,感觉很不爽。是否有个方法可以设置一个所谓的全局鼠标或者叫全局滚动来解决这一问题。请高人指点。感谢刚刚yeness() 的回帖,我在遨游浏览器里面测试实现了效果以为是你给的方法起作用了,后来我发现我不用你的方法在遨游里面也可以,但是不管怎样在IE里面就是不行,使用你的方法也不行,还请指点。yeness() 的回帖
<html>
<head>
</head>
<body>
<div id="div1" style="width:100; height:100; overflow:scroll" onscroll="funcsrcoll()">
<iframe src="tt.htm" scrolling="no"></iframe>
</div>
<div id="div2" style="width:100; height:100; overflow:scroll">
<iframe src="tt.htm" scrolling="no"></iframe>
</div>
</body>
</html>
<script language="JavaScript" type="text/JavaScript">
function funcsrcoll()
{
div2.scrollLeft = div1.scrollLeft;
div2.scrollTop = div1.scrollTop;
}
</script>运行错误:属性“onscroll”不是元素“div”的有效属性
<body>
<form id="form1" runat="server">
<div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<iframe runat="server" id="TopIframe" height="115" src="Top.aspx" scrolling="no" width="774" frameborder="0"></iframe>
</td>
</tr>
<tr>
<td>
<iframe runat="server" id="MiddleIframe" src="Middle.aspx" scrolling="no" width="774" frameborder="0"></iframe>
</td>
</tr>
<tr>
<td>
<iframe id="BottomIframe" src="Bottom.aspx" width="100%" scrolling="no" frameborder="0"></iframe>
</td>
</tr>
</table>
</div>
</form>
</body>
页面Middle.aspx里面又包含有frameset,外面一个frameset是用来做自动高度的,里面一个是真正包含内容的
<noframes>您的浏览器不支持框架</noframes>
<frameset id="LayoutFrameset" rows="0,*" frameborder="0" framespacing="0">
<frame id="LayoutTop" src="#" noresize="noresize" />
<frameset id="pMainFrameset" frameborder="0" framespacing="0" cols="158,616">
<frame id="pleft" name="pleft" scrolling="no" noresize="noresize" src="Left.aspx?wNO=<%=WebNO()%>" />
<frame id="pmain" name="pmain" scrolling="no" noresize="noresize" src="Main.aspx?wNO=<%=WebNO()%>" allowtransparency="true" runat="server" />
</frameset>
</frameset>
在Main.aspx页面我已经搞定了高度的自动变化
<script type="text/javascript">
window.onload=function()
{
if(window.document.body.scrollHeight<680)
{
window.parent.document.all("LayoutFrameset").rows="0,680";
window.parent.parent.document.all('MiddleIframe').height=680;
}
else
{
window.parent.document.all("LayoutFrameset").rows="0,"+window.document.body.scrollHeight;
window.parent.parent.document.all('MiddleIframe').height=window.document.body.scrollHeight;
}
}
</script>
我的问题是:在Default.aspx页里面在iframe外面才可以使用滚轮控制滚动条,而鼠标移动到iframe里面的frameset里面的无论是left.aspx或者Main.aspx页的时候,不管怎么滚动滚轮,滚动条都不动,让人非常难过,一定要把鼠标移动到iframe(frameset)外面来才起作用,感觉很不爽。是否有个方法可以设置一个所谓的全局鼠标或者叫全局滚动来解决这一问题。请高人指点。感谢刚刚yeness() 的回帖,我在遨游浏览器里面测试实现了效果以为是你给的方法起作用了,后来我发现我不用你的方法在遨游里面也可以,但是不管怎样在IE里面就是不行,使用你的方法也不行,还请指点。yeness() 的回帖
<html>
<head>
</head>
<body>
<div id="div1" style="width:100; height:100; overflow:scroll" onscroll="funcsrcoll()">
<iframe src="tt.htm" scrolling="no"></iframe>
</div>
<div id="div2" style="width:100; height:100; overflow:scroll">
<iframe src="tt.htm" scrolling="no"></iframe>
</div>
</body>
</html>
<script language="JavaScript" type="text/JavaScript">
function funcsrcoll()
{
div2.scrollLeft = div1.scrollLeft;
div2.scrollTop = div1.scrollTop;
}
</script>运行错误:属性“onscroll”不是元素“div”的有效属性
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货