+ Reply to Thread
Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: JS Show a pic when site is loading.

  1. #1
    gaptrast's Avatar
    gaptrast is offline x10 Sophmore gaptrast is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    117

    Exclamation JS Show a pic when site is loading.

    Hello, I need to have this on my site: When the site is loading appear a image like "please wait until the site load", and when it has finhished it says "you have succesffully loaded the page". How can I get this work? ( can I use Javascript?) Regards

  2. #2
    vishal's Avatar
    vishal is offline -::-X10 Guru-::- vishal has a brilliant futurevishal has a brilliant future
    Join Date
    Nov 2009
    Location
    INDIA
    Posts
    5,254

    Re: JS Show a pic when site is loading.

    If you have a page that takes long time to display it is a good idea to display a "wait until the page loads" image. Try this

    To implement this you will need to:

    1. Every time your page loads a "init()" function will load.

    <body onLoad="init()">

    2. Define a div named "loading" right after <body> section.

    <div id="loading" style="position:absolute; width:100%; text-align:center; top:300px;">
    <img src="loading.gif" border=0></div>

    The loading.gif image should be an animated gif that suggests that the page is still loading.

    3. Place this javascript code right after you define the div.

    <script>
    var ld=(document.all);
    var ns4=document.layers;
    var ns6=document.getElementById&&!document.all;
    var ie4=document.all;
    if (ns4)
    ld=document.loading;
    else if (ns6)
    ld=document.getElementById("loading").style;
    else if (ie4)
    ld=document.all.loading.style;
    function init()
    {
    if(ns4){ld.visibility="hidden";}
    else if (ns6||ie4) ld.display="none";
    }
    </script>
    DONT FORGET TO REP
    Last edited by vishal; 01-11-2010 at 10:16 AM.
    Regards ~ Vishal
    Giving Reputation (at bottom of my post ) is the best way to encourage the person who helped you on forums.

  3. #3
    slacker3 is offline x10 Sophmore slacker3 is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    146

    Re: JS Show a pic when site is loading.

    Wouldn't onLoad be triggered when the document is finished loading ?

  4. #4
    vishal's Avatar
    vishal is offline -::-X10 Guru-::- vishal has a brilliant futurevishal has a brilliant future
    Join Date
    Nov 2009
    Location
    INDIA
    Posts
    5,254

    Re: JS Show a pic when site is loading.

    Quote Originally Posted by slacker3 View Post
    Wouldn't onLoad be triggered when the document is finished loading ?
    nope., it was woking fine
    Regards ~ Vishal
    Giving Reputation (at bottom of my post ) is the best way to encourage the person who helped you on forums.

  5. #5
    legendkiller4all is offline x10Hosting Member legendkiller4all is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    13

    Re: JS Show a pic when site is loading.

    i got an error

  6. #6
    vishal's Avatar
    vishal is offline -::-X10 Guru-::- vishal has a brilliant futurevishal has a brilliant future
    Join Date
    Nov 2009
    Location
    INDIA
    Posts
    5,254

    Re: JS Show a pic when site is loading.

    Quote Originally Posted by legendkiller4all View Post
    i got an error
    Whats the error ,pls specify
    Regards ~ Vishal
    Giving Reputation (at bottom of my post ) is the best way to encourage the person who helped you on forums.

  7. #7
    legendkiller4all is offline x10Hosting Member legendkiller4all is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    13

    Re: JS Show a pic when site is loading.

    THe image loading stops and then i had to refesh

  8. #8
    vishal's Avatar
    vishal is offline -::-X10 Guru-::- vishal has a brilliant futurevishal has a brilliant future
    Join Date
    Nov 2009
    Location
    INDIA
    Posts
    5,254

    Re: JS Show a pic when site is loading.

    is ur browser javascript supported
    Regards ~ Vishal
    Giving Reputation (at bottom of my post ) is the best way to encourage the person who helped you on forums.

  9. #9
    legendkiller4all is offline x10Hosting Member legendkiller4all is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    13

    Re: JS Show a pic when site is loading.

    yes

  10. #10
    vishal's Avatar
    vishal is offline -::-X10 Guru-::- vishal has a brilliant futurevishal has a brilliant future
    Join Date
    Nov 2009
    Location
    INDIA
    Posts
    5,254

    Re: JS Show a pic when site is loading.

    i recommend that u use firefox
    Regards ~ Vishal
    Giving Reputation (at bottom of my post ) is the best way to encourage the person who helped you on forums.

+ Reply to Thread
Page 1 of 3 123 LastLast

Similar Threads

  1. My Site is Not Updating & there are Problems Loading
    By EdisonTigersAlumni in forum Free Hosting
    Replies: 6
    Last Post: 08-14-2008, 02:11 AM
  2. site not loading
    By allinone in forum Free Hosting
    Replies: 5
    Last Post: 08-05-2008, 02:16 AM
  3. Site not loading
    By Charis Core in forum Free Hosting
    Replies: 1
    Last Post: 07-30-2008, 10:57 AM
  4. My Site Not Loading
    By Articz in forum Free Hosting
    Replies: 1
    Last Post: 06-12-2006, 12:40 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers