Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 8 of 8
  1. #1
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default [JS] Loading after a certain time..

    Havent seen one posted, but whats the function to carry out an action after a certain time.

    Whats happening in my case is im using a function that loads the entire website, that same function loads the pages inside the website, but it seems to be loading the things inside the page before the actual page has finished loading.. :|

    Any help anyone.?

    Code.

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>HabboRave</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style typ="text/css">
    body{font-family:verdana; font-size:11px; color:#000000; background-image:url(bg/hab_grey.png); background-attachment:fixed;}
    #adverts{background-image:url(img/adverts_rollover.gif); background-position:top;}
    #adverts:hover {background-image:url(img/adverts_rollover.gif); background-position:bottom; cursor:pointer;}
    #adverts_selected{background-image:url(img/adverts_white.gif);}
    
    #dj{background-image:url(img/dj_rollover.gif); background-position:top;}
    #dj:hover{background-image:url(img/dj_rollover.gif); background-position:bottom; cursor:pointer;}
    #dj_selected{background-image:url(img/dj_white.gif);}
    
    .hr_stats{background-image:url(img/habborave_r3_c15.gif); padding:0px; font-family:verdana; font-size:11px; font-color:#FFFFFF;}
    </style>
    
        <script type="text/javascript" src="js/prototype.js"></script>
        <script type="text/javascript" src="js/scriptaculous.js"></script>
        <script type="text/javascript">
        function cpage(page)
        {
            document.getElementById("hr_content").innerHTML = '<img src="img/load_big.gif" border="0" /><br />Loading...';
            new Ajax.Updater('hr_content',page);
        }
        function stats()
        {
            document.getElementById("hr_stats").innerHTML = '<img src="img/load_small.gif" border="0" />';
            new Ajax.Updater('hr_stats','page/stats.php');
        }
        function initpage()
        {
            document.getElementById("main_div").innerHTML = '<img src="img/load_big.gif" border="0" /><br />Please wait whilst HabboRave Loads...';
            new Ajax.Updater('main_div','habborave.htm');
            stats();
            setInterval("stats()",40000);
        }
        </script>
    </head>
    <body onload="initpage();">
    <div id="main_div" align="center">
    </div>
    </body>
    </html>
    Coming and going...
    Highers are getting the better of me

  2. #2
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    setTimeout("functionname", time in ms);


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

  3. #3
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    Oooh. Ty Dan

    Any suggestions how else i could do this, as obv the loading time for everyone varies...
    Coming and going...
    Highers are getting the better of me

  4. #4
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    Quote Originally Posted by MrCraig View Post
    Oooh. Ty Dan

    Any suggestions how else i could do this, as obv the loading time for everyone varies...
    Yep, this'll do it as soon as their page has loaded:

    window.onload = function() {
    dothisfunction();
    }


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

  5. #5
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    Not working..

    Getting the document.getElementById("hr_stats") has no properties error message again..
    Coming and going...
    Highers are getting the better of me

  6. #6
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    Quote Originally Posted by MrCraig View Post
    Not working..

    Getting the document.getElementById("hr_stats") has no properties error message again..
    There's no element with the id hr_stats (e.g <div id="hr_stats">)


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

  7. #7
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    There is..

    It works on the setInterval method..
    So it must work..

    Or when i call the function manually from the browser location.
    Coming and going...
    Highers are getting the better of me

  8. #8
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    Quote Originally Posted by MrCraig View Post
    There is..

    It works on the setInterval method..
    So it must work..

    Or when i call the function manually from the browser location.
    The error is saying there isn't.


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

Posting Permissions

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