开发者

Auto scroll down iframe

How can I get an iframe such that when it loads up, it loads up with the page inside scrolled down by a fixed amount开发者_StackOverflow中文版 (say 100px)?

I have so far:

<iframe src="http://news.bbc.co.uk/1/hi/uk/7459669.stm" scrolling="no" width=500px height=500px></iframe>

but it loads up with the bbc.co.uk page inside at the top left when I actually want it to load up scrolled part way down (that is the page inside the iframe scrolled down, not the page containing the iframe).

Anyone know how to do this?


Its not exactly what you are looking for but you could set the URL to load scrolled to a particular element if you know that an element with that ID will always be on the page. Something like this:

http://news.bbc.co.uk/2/hi/uk_news/7459669.stm#mediaAsset

HTH


You can not do this. Browser security restrictions will prevent you from accessing the "inside" of that frame completely. If the frame src was from the same domain as the containing page, then you could add an onload handler that set myiframe.contentDocument.body.scrollTop = 100;.


Genrally I Do Specify marginheight attribute on iframe for this

<iframe src='url' marginheight='100px'>

You can also use marginwidth attribute to move inner page left side

for more information checkout this link

http://www.w3schools.com/tags/tag_iframe.asp

I hope Thats Help

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜