开发者

Scrollbar to Top of iFrame Container Div on Each Page Load?

I have an iframe with external content that is scrolled from a parent div (the iframe has a large height, while the iframe container div has a smaller height).

As a result, when I scroll to the bottom, the scrollbar stays there when I load another page into the iframe.

Is there any way to send the container scroll开发者_Python百科bar to the top whenever the iframe loads another page?

Thank you.


I guess this was relatively simple, but it wasn't working for me when I had the javascript in an external file. So I put it into the HTML file:

<script language="javascript">
function gotop()
{
document.getElementById('iframeContainer').scrollTop = 0;
}
</script>

<iframe src="http://whatever.com" onload="gotop()"></iframe>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜