/    Sign up×
Community /Pin to ProfileBookmark

Flash Intro/ Iframe Help!

Hi,
what I’m trying to do is have a short flash intro play while my site loads, and once its done, replace the intro with the content of the index page. I’m using iframes to show the content of the home page and the flash movie. This is what I have:
(index.php)

[CODE]
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Untitled Document</title>

</head>

<body onload=”introReplace”>

<div id=”flashIntro”>
<iframe src=”intro2SEC.html” name=”theIntro” width=”600px” height=”600px” scrolling=”No” frameborder=”0″></iframe>
</div>

<script language=”javascript”>
function introReplace () {

document.getElementById(‘flashIntro’).innerHTML = homepage.document.getElementById(‘content’).innerHTML;

}
</script>
<iframe name=”homepage” src=”index2.php” width=”0″ height=”0″ frameborder=”0″ scrolling=”no”></iframe>

</body>
</html>

[/CODE]

and in index2.php, where all the content of the site is:

[CODE]
<div id=”content”>
//
//
//
// * HOME PAGE CONTENT *
//
//
//
</div>
[/CODE]

I’m not sure why it doesn’t work. I figured that putting the “introReplace” function into the body onLoad attr. would replace the intro movie with the page once it finished loading… Any Advice appreciated.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@slaughtersOct 15.2007 — I don't think you are allowed to get the innerHTML of a page that is not a child of the current page (ie, not a pop-up)

But - you can just change the source of the iframe to point to the new page. It should be quick because you will already have it cached.

Don't do this:

document.getElementById('flashIntro').innerHTML = ...

Do something like this:

frameObj = document.getElementById('theIntro');

frameObj.src = 'index2.php';

frameObj.width = ??;

frameObj.height = ??;

Assuming that you make 'theIntro' be the frames ID in addtion to it's name.
×

Success!

Help @silentq 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 6.18,
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: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

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