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!
willsherwoodAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
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.
0
willsherwoodAuthor Commented:
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
0
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
You should simply recreate what you are doing with sample data in a non protected directory.  You want to recreate just a simple example.  This explains it pretty well http://css-tricks.com/reduced-test-cases/

If it helps, I created a sample page to be framed http://jsbin.com/iXOBePo/2/edit and the main page http://jsbin.com/ohUfOvA/2/edit?html,output

There is a button at the bottom.  Is that what you are trying to get to?  If not, please upload your own sample or edit the jsbin's.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
willsherwoodAuthor Commented:
thanks
window.parent.$("body").animate({scrollTop:0}, 'slow');
did the trick
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.