Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder GSimpson's Avatar
    Join Date
    Aug 2006
    Location
    New Zealand
    Posts
    268
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Cool Loading... Script.

    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.
    The internet is my Sandbox, and notepad is my Spade n' Bucket.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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.
    Code:
    <!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/dynamici...loadimage2.htm
    Last edited by _Aerospace_Eng_; 08-08-2006 at 07:30 AM.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder GSimpson's Avatar
    Join Date
    Aug 2006
    Location
    New Zealand
    Posts
    268
    Thanks
    9
    Thanked 0 Times in 0 Posts

    ...Hmm interesting

    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.
    The internet is my Sandbox, and notepad is my Spade n' Bucket.

  • #4
    Senior Coder
    Join Date
    Feb 2006
    Location
    USA
    Posts
    1,013
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Do you realize that JavaScript login scripts are easily bypassed?

    I suggest you read these:
    The Importance of Degrading Gracefully
    Perpetuating the myths of JavaScript degradation.
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions
    Java != JavaScript && JScript != JavaScript
    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

  • #5
    Regular Coder GSimpson's Avatar
    Join Date
    Aug 2006
    Location
    New Zealand
    Posts
    268
    Thanks
    9
    Thanked 0 Times in 0 Posts
    What about http access or what ever it is. I really have only heard of it slightly.
    Last edited by GSimpson; 08-09-2006 at 02:47 AM.
    The internet is my Sandbox, and notepad is my Spade n' Bucket.

  • #6
    Regular Coder GSimpson's Avatar
    Join Date
    Aug 2006
    Location
    New Zealand
    Posts
    268
    Thanks
    9
    Thanked 0 Times in 0 Posts
    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.
    The internet is my Sandbox, and notepad is my Spade n' Bucket.

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #8
    Regular Coder GSimpson's Avatar
    Join Date
    Aug 2006
    Location
    New Zealand
    Posts
    268
    Thanks
    9
    Thanked 0 Times in 0 Posts
    its not suppose to be helpful, its a show thing. Its for people that dont know flash or none of that.
    The internet is my Sandbox, and notepad is my Spade n' Bucket.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •