Link to home
Start Free TrialLog in
Avatar of willsherwood
willsherwood

asked on

HTML frames: how to scroll to top of parent

what JS code can i put in a child frame HTML  such that  upon entering that child page,
the parent scrolls to the top?
the child frame is very tall, and has a SUBMIT for a search.
(AJAX is not desirable for this situation)

perhaps some variation of:
document.body.scrollTop = document.documentElement.scrollTop = 0;
but reference the parent,
and do it by default upon entering the child page.

thanks!
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Can you please post a link to your example page?  If you don't have one, then just create a simple example and upload so we can see what you are talking about.
Avatar of willsherwood
willsherwood

ASKER

the top level (parent) iframe =
<p><iframe style="background: transparent;" src="http://xxx.org/members/member-directory.php?k=1685" height="3085" width="700" seamless="seamless"></iframe></p>

(it's a protected directory, sorry)

in the file member-directory.php
i'd like a JS statement that scrolls the parent window to its top
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks
window.parent.$("body").animate({scrollTop:0}, 'slow');
did the trick