Force parent frame, from within iFrame to Scroll

Is there a way - from a JS event in my iFrame, to force the Parent Frame to Scroll to the top?
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.

Only if the contents of the iframe and the parent are on the same domain.  There are security restrictions enforced on iframes which in most cases prevent you from accessing the iframe from the parent and vice versa.

Here's a bit of a discussion on the subject with a similar question to yours.  Also a bit of a solution for you provided you're using the same domain for both:
DId you try parent.scroll(0,0)?
<iframe src="2.htm" height="200" width="300"></iframe>
index2.htm (iframe)
<a href="javascript:void(0)" onclick="parent.scroll(0,0)">click</a>

Open in new window

tbaseflugAuthor Commented:
It will be cross-domain, but assuming that I can get access to the parents source code - is there any workaround from that perspecive?
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Unfortunately for you, no.  If you try to access one document from the other (via the iframe) javascript will throw errors and not do anything else.
tbaseflugAuthor Commented:
Is there a way - from within the iFrame - to force the iFrame to scroll up to the top of the iFrame or jump up to something like an anchor
Yes, you can tell the iframe to scroll itself or the parent to scroll itself.

From within the iframe or the parent (whichever you wish to scroll):

document.body.scroll(0,0) (as nick_bal mentioned)
Personally, I use document.body.scrollTop = 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
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

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.