Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

page load question

Status
Not open for further replies.

karren

Programmer
Feb 26, 2002
42
CA
i have a question:

i want to create a page where a certain message appears while the page is loading and this message changed once the page has loaded.

is this possible to do? where would i start with this?

thanks all!

karren
 
Here is an example:
Code:
<html>
<head>
<title>Loading</title>
<script language="javascript">
<!--
var win = window.open("about:blank","welcome");
win.document.writeln("<html><head><title>Welcome</title></html>");
win.document.writeln("<body><h3>Your page is loading...</h3></body>");
win.document.writeln("</html>");

function closeWin()
{
  win.close();
}
// -->
</script>
<body onload="closeWin();">
<script>
// Take a long time to load
for (var i=0;i<100000;i++)
{
  document.writeln("<h1>Text"+i+"</h1><br>");
}
</script>
</body>
</html>
This takes advantage of the fact that the head loads first, opening the window before anything else. After the body has finished loading, the window is closed.

--Chessbot

"See the TURTLE of enormous girth!"
-- Stephen King, The Dark Tower series
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top