/    Sign up×
Community /Pin to ProfileBookmark

onload Iframe/child to reset parent x, y

Hi, hoping someone can help me with an onload script.
I have a page with an IFRAME in it. When a page loads into my IFRAME i want the main/parent page to scroll down to where the IFRAME is positioned.
So i need an “onload” script to put into my page thats loading into the IFRAME that will call the parent to moveTo or scrollTo new position. I dont want the parent to scroll down until the child page loads. Can anyone help me with this? Thanks in advance!

to post a comment
HTML

14 Comments(s)

Copy linkTweet thisAlerts:
@auto_webFeb 04.2009 — put something like <a name="frame"></a> just before the iframe

and when linking to your page do it like link.html#frame

or see if this is of any help
Copy linkTweet thisAlerts:
@donbudzauthorFeb 04.2009 — Little more info on what I am doing.

I have a Flash Menu at the top of "Parent window" when a user clicks a button in the Flash Menu a page will load into the IFRAME. The IFRAME is located at bottom of "Parent window". It is located off screen the user will not see it load.

I need the "Parent window" to scroll down to the IFRAME when user clicks the button in the flash menu at the top of "Parent window". I need to have either a button action in Flash or a script in IFRAME page to scroll "Parent window" to IFRAME position. I do not want the "Parent window" to refresh as this will reload my flash movie. Thanks for any help. PS i am kinda a noobie!
Copy linkTweet thisAlerts:
@donbudzauthorFeb 04.2009 — What I'm working on is located here:

http://www.donswebdesigns.com

This is site is work in progress, IFRAME is located at bottom of page.
Copy linkTweet thisAlerts:
@FangFeb 04.2009 — The document in the iframe must have an onload that scrolls the top document.
Copy linkTweet thisAlerts:
@donbudzauthorFeb 04.2009 — The document in the iframe must have an onload that scrolls the top document. [/QUOTE]
EXACTLY!! thank you Fang!


Anyone, help me with that?
Copy linkTweet thisAlerts:
@FangFeb 04.2009 — window.onload=function() {parent.iframeName.scrollInToView();};
Copy linkTweet thisAlerts:
@donbudzauthorFeb 04.2009 — Thanks for the response Fang, however, its not working for me. I put the line u posted into my IFRAME page and it done nothing. I may not be putting the line into my code correctly. Is there a certain place I put this line or a tag i need to add to it? Thanks for your help with this.
Copy linkTweet thisAlerts:
@FangFeb 04.2009 — Isn't the forum loaded into [I]communicator_main[/I]?
Copy linkTweet thisAlerts:
@donbudzauthorFeb 04.2009 — um ya... 'bout that..


Index is the parent page,

first generation IFRAME is "communicator"

second generation IFRAME is "communicator_main"

"generalforum_loader.html" loads into "communicator_main"

then the forum loads... "/general/index.php"
Copy linkTweet thisAlerts:
@donbudzauthorFeb 04.2009 — ...so i actually have an IFRAME within an IFRAME.

parent.communicator.communicator_main

im using the pre-loader page for the onload event to reset parent position.

the page i want to use this onLoad event is located

"parent.communicator.communicator_main"
Copy linkTweet thisAlerts:
@donbudzauthorFeb 04.2009 — still i cant just throw that code in anywhere can i? isnt that jave script? shuldnt there be <script="java language"> </script> on there?
Copy linkTweet thisAlerts:
@donbudzauthorFeb 05.2009 — Flash movie to link to HTML anchor:

FLASH BUTTON ACTION (link to anchor)

"flash.swf" movie
[CODE]on (release) {
getURL("my.html#bottom");
}[/CODE]


HTML CODE (anchor) placed rite above IFRAME or any location you want in the HTML

"my.html" page
[CODE]<a name="bottom"></a>
[/CODE]

Also this works without refreshing the page!

Thanks Auto_Web and Fang for your help.
Copy linkTweet thisAlerts:
@donbudzauthorFeb 05.2009 — ok.. my bad it refreshes the parent page. For whatever reason it only does it once.. then no more refreshing.. weird. I'm lookin for away to goto anchor without refresh.
Copy linkTweet thisAlerts:
@donbudzauthorFeb 05.2009 — Think I have got it now!!


To keep Main/Parent page from reloading when linking to the

anchor, I simply put the anchor in the IFRAME page.

Had to change the Flash Button Action a bit.

Flash Button Action (targeting anchor within IFRAME page)
[CODE]on (release) {
getURL("my.html#bottom", "IFRAME_name");
}[/CODE]

Thanks, later dudes
×

Success!

Help @donbudz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...