Log in

View Full Version : code to snap to the top of the page (iframes)



lainer
12-07-2006, 02:59 PM
I am using 2 iframes on a page. One is static and contains a flash menu, the other loads in different html pages. My problem is when I have a long page loaded into it with a link at the bottom. This link loads in a shorter page so it shows up as a blank space until u scroll back up to the top of the page. I want a way to make the page snap up to the top. I have tried using "target_top" but this overwrites the iframe at the top.

Thanks for any help received.
lainer

jscheuer1
12-07-2006, 06:40 PM
Don't use target for that. The only HTML solution for this is to add an anchor name to the page (the one you will be loading into the iframe) at its top, just after its opening <body> tag:


<a name="top"></a>

Then when linking to that page, use this type href in your anchor link:


<a href="whatever.html#top">Whatever</a>

If the situation is such that this cannot be done or doesn't solve the specific problem you are talking about, a redesign of the page to get your content into the actual position where you want it to be may be in order or you may wish to resort to javascript.

To be of much more help, I would need to have a link to the problem page(s).