On Thu, 12 Feb 2004 06:58:45 -0800, Dennis M. Marks
<de******@domain.invalid> wrote:
I have a page that uses divisions, tables, iframes, and forms, and is
partially built using javascript. As it loads parts of the page appear
in odd places and move as other parts are built. How can I keep the
page from appearing until it is completely built?
You shouldn't, really.
I'm used to seeing pages gradually build and reshape due to my dial-up
connection. It really isn't something that users will dislike.
If you really want to do this, give the BODY an ID and place this at the
end of the HEAD block (changing 'bodyID' as appropriate):
<script type="text/javascript">
function getObjectRef( id ) {
if( document.getElementById ) {
return document.getElementById( id );
} else if( document.all ) {
return document.all[ id ];
}
return null;
}
function hideDocument() {
var bodyRef = getObjectRef( 'bodyID' );
if( bodyRef && bodyRef.style &&
'string' == typeof bodyRef.style.display ) {
bodyRef.style.display = 'none';
}
}
function showDocument() {
var bodyRef = getObjectRef( 'bodyID' );
if( bodyRef && bodyRef.style &&
'string' == typeof bodyRef.style.display ) {
bodyRef.style.display = 'block';
}
}
</script>
....place this at the very beginning of the BODY block:
<script type="text/javascript">
hideDocument();
</script>
....and call showDocument() onload.
However, bear in mind that users might be confused why your page is empty
if it takes too long to load.
Mike
The code above has been tested on Opera 7.23, IE 6, Mozilla 1.6 and
Netscape 7.
--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)