...

View Full Version : Loading... Script.



GSimpson
08-08-2006, 05:25 AM
Ok you can see an example of the script in my signiture however
that site is down. It will display the loading part and after about 20 seconds or so it will alert you a welcome message.

My plans are to make it so after the alert i have "document.write" script that will display all of the content on this one page. Then creating a nice 1 Page website that has everything you need on it.

Basiclly on that all I want is some information about document.write,
like can I make it write images, edit tags etc.

When I finish my website I will see if people concider the code useful and if so then I will put it up for use in the javascript codes.

Cheers.

_Aerospace_Eng_
08-08-2006, 06:01 AM
Why would you want to use a document.write to write out a whole page. What about the users with JS disabled? They will see nothing. There are many preloading scripts out there already. Will link to a few in this post. Here is something I just wrote that degrades gracefully for users with JS disabled.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<style type="text/css">
html, body {
margin:0;
padding:0;
}
#loading {
border:1px solid #000;
background:#CCC;
color:#000;
padding:4px;
width:200px;
position:absolute;
left:50%;
top:50%;
margin-left:-102px;
margin-top:-29px;
height:50px;
line-height:50px;
text-align:center;
display:none;
}
</style>
<script type="text/javascript">
var i = 0;
var styles = document.createElement('style');
var styleprops = document.createTextNode('#content { display:none }');
styles.appendChild(styleprops);
document.getElementsByTagName('head')[0].appendChild(styles);

function showContent()
{
document.getElementById('loading').style.display = 'none';
alert('Welcome to the site!');
document.getElementById('content').style.display = 'block';
}
window.onload = function()
{
document.getElementById('loading').style.display = 'block';
window.setTimeout('showContent()',15000);
}
</script>
</head>
<body>
<div id="loading">Loading...</div>
<div id="content"> content goes here </div>
</body>
</html>
http://www.dynamicdrive.com/dynamicindex4/preloadit.htm
http://www.dynamicdrive.com/dynamicindex4/preloadimage2.htm

GSimpson
08-08-2006, 07:20 AM
I see your point of view and i get what you mean.
however I do have another plan

I need to have js enabled because of my login thing.

So what I might do is at end of timeout it could window.location?

cheers again.

Kravvitz
08-08-2006, 07:24 AM
Do you realize that JavaScript login scripts are easily bypassed?

I suggest you read these:
The Importance of Degrading Gracefully (http://weblog.burningbird.net/archives/2005/03/25/the-importance-of-degrading-gracefully/)
Perpetuating the myths of JavaScript degradation. (http://domscripting.com/blog/display.php/25)

GSimpson
08-09-2006, 03:44 AM
What about http access or what ever it is. I really have only heard of it slightly.

GSimpson
08-09-2006, 03:50 AM
well b4 we get off the topic of loading scripts I have finsished one and is now on my website. Its called the loading... script.Sorry Its the only thing up at the moment the film is still being check up on and my js game is being converted to HTA. So I shall make more pointless scripts.

_Aerospace_Eng_
08-09-2006, 06:16 AM
How is that script helpful? It really doesn't help load anything. Its only a page to make the user way longer. The content page doesn't load anywhere in the loading page. Maybe put the content page in a hidden iframe on the loading page?

GSimpson
08-09-2006, 09:39 AM
its not suppose to be helpful, its a show thing. Its for people that dont know flash or none of that.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum