Click to See Complete Forum and Search --> : Changing div visibility to 'none' onload?


yeago
04-23-2004, 08:56 PM
Here is the situation:

I would like my site to contain an intro description, contained in a <div.>, however, I would like this to go away and be replaced by a user interface <div.> when the user interacts with iframe.html present in an iframe on index.html

Ideally, iframe.html would contain a <body onload=make parent div invisible, then make interface div visible in its place.>

Could anyone give me some snippets of code? I've always concentrated on other areas of site design--never JavaScript.

Thank you!

gil davis
04-24-2004, 07:56 AM
Perhaps this is something that will help:

http://javascript.internet.com/page-details/preload-page.html

yeago
04-24-2004, 07:59 AM
Interesting, but not precisely what I had in mind.

Essentially, when the Iframe has loaded (and the user has searched for something on my site), I want the <div.> containing my site introduction to go away, and then make visible another <div.> where that one was.

Pittimann
04-24-2004, 08:16 AM
Hi!

First make sure, that the introduction div is set to display=block and the interface div to display=none; example:

<div id="introduction" style="display:block">introduction content goes here</div>
<div id="interface" style="display:none">interface content goes here</div>

Then you can put into you iframe's doc's body tag:
<body onload="parent.frames[0].document.getElementById('introduction').style.display='none';parent.frames[0].document.getElementById('interface').style.display='block';">

Please note: the "parent.frames[0].document..." assumes that the frame with the two divs is the first frame in your document.

Cheers - Pit

yeago
04-24-2004, 09:18 AM
Great! Thank you!

The divs aren't in a frame at all

(http://www.bookproxy.com/iframe.php)

But I should be able to adapt your script! I really appreciate this. Its a big help

Pittimann
04-24-2004, 09:27 AM
Hi!

You're welcome :)!

Cheers - Pit