<body>
<form id="form1" runat="server">
<iframe id="topFrame" width="800px" height ="140px;" style=" margin:0px 0px 0px 0px" frameborder="0" scrolling="no" src="topStocks.aspx">
</iframe>
<iframe id="mainFrame" width="800px" name="mainFrame" scrolling="no" style=" margin:0px 0px 0px 0px" height ="500px" frameborder="0" src="aaaa.aspx">
</iframe>
</form>
</body>
两个iframe 一个topFrame,一个mainFrame
在aaaa.aspx的js里写的代码,
执行fnSetUrl() 导致父页面滚动了(像锚一样滚动到mainFrame)!
你执行的涵数fnSetUrl()时肯定是用到了A标签(<a
href=‘#‘ onclick=‘fnSetUrl()‘>跳转</a>)
这样先执行href="#"这个操作后,导致了父页面滚动
改成<a href=‘javascript:fnSetUrl()‘
>跳转</a>就没有问题 了!
你执行的涵数fnSetUrl()时肯定是用到了A标签(<a href=‘#‘
onclick=‘fnSetUrl()‘>跳转</a>)
这样先执行href="#"这个操作后,导致了父页面滚动
改成<a
href=‘javascript:fnSetUrl()‘
>跳转</a>就没有问题 了!
原文:http://www.cnblogs.com/SummerRain/p/3562531.html