tbaseflug
asked on
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?
DId you try parent.scroll(0,0)?
index1.htm
<p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p>
<p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p>
<p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p>
<iframe src="2.htm" height="200" width="300"></iframe>
-------------------------------------------------------------------
index2.htm (iframe)
<a href="javascript:void(0)" onclick="parent.scroll(0,0)">click</a>
ASKER
It will be cross-domain, but assuming that I can get access to the parents source code - is there any workaround from that perspecive?
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.
ASKER
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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: http://bytes.com/forum/thread150689.html