PDA

View Full Version : hiding page, until it's loaded


allyson
07-16-2002, 03:23 AM
Hi

I would like to know how I could hide a webpage until it's been loaded, so that all the images appear once the layer has been removed.

Thanks

bye
Allyson

jkd
07-16-2002, 03:46 AM
<body style="visibility: hidden" onload="this.style.visibility = 'visible'">

Try that. :)

Cloudski
07-16-2002, 03:54 AM
I have a question to add on to that... how do you post a message saying that the page os loading, so they don't think your page is just plain not there?

<body style="visibility: hidden" onload="this.style.visibility = 'visible'">

That simple!?!? I once looked for something that would do something like that, and the code looked to bo something VERY large, and I was too scared, and too stupid :) , at the time to try to read it :D

jkd
07-16-2002, 04:11 AM
Hmmmm:

<body style="visibility: hidden" onload="document.getElementById('pageLoader').style.display = 'none';this.style.visibility = 'visible'">

<div id="pageLoader" style="visibility: visible;">
The page is loading...
</div>

Maybe? :)

Cloudski
07-16-2002, 04:42 AM
Nope, it has an error saying this.style = 'null' or is undefined.... :confused: or did it say style.this... whell you get the point.... :) Maybe I need to look for that long old script again.....

jkd
07-16-2002, 05:55 AM
All hope is not lost yet - I dunno why it would incorrectly handle the this reference though:

<body style="visibility: hidden" onload="document.getElementById('pageLoader').style.display = 'none';document.body.style.visibility = 'visible'">

<div id="pageLoader" style="visibility: visible;">
The page is loading...
</div>

Cloudski
07-16-2002, 07:00 AM
:( Well, i is still a no go... Now it doesn't even load the page... it basically just gives a white screen, with the page load bar hardly going up... and I am testing on my comp.. so...

Oh well, I will try to find a site that does that and look at the src code again :D If I find anything, I will be sure to post it.

Zvona
07-16-2002, 09:32 AM
Remember, when an user has JS disabled or his/her browser don't support it, page will never re-appear.

Here's something that indicates page loading :<!-- Example Written by Zvona -->
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Untitled</title>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1;" />
<script type="text/javascript">
<!--
var iI = 0;
var sMsg = "Please wait . . .";
var ivProcess = setInterval('zProcessing()',250);

function zProcessing()
{
if (iI > sMsg.length)
{
iI = 0;
window.status = "";
}

window.status += sMsg.substring(iI,iI+1);
iI++;
}


window.onload = function()
{
clearInterval(ivProcess);
window.status = "";
}
// -->
</script>
</head>

<body>
<p>Content</p>
</body>
</html>