someone that knows how to do array line preloader

Discussion in 'JavaScript' started by 1jen, May 15, 2011.

  1. #1
    http://www.bloggingdeveloper.com/pos...avascript.aspx http://elouai.com/javascript-preload-images.php Those are some other examples. How to preload array items with my script shown below instead.

    Hello it's regular javascript. I just have a regular array happening. The only part I'm hung up on is a preloader to get a head start on the next line, because some of my loading items are pretty big and just need a bit of a head start so the next line is loading by time for them to execute. All this code isn't too important and need to keep the array lines numbered. What need help with is how to start preloading or preload the next array line it will call. Or if they can all be loading by time for an array line to be called, as long as it doesn't slow down a web page from loading. However is the best way. So-

    var arr=[];

    var arr=[];
    arr[0] = ["<img style='width:800px;height:800px;margin-left: 0px;margin-top: 0px;' title='Image1' border='0' src='http://events.spiritmountain.com/images/bus.jpg'/>"];
    arr[1] = ["<span style='color: rgb(200,200,200)'>a lot of text here</span>"];
    etc.

    function cookie() {get = parseInt(readCookie("t"), 10); if (isNaN(get))
    {get = random(arr.length);}get = (get + 1) % arr.length;
    document.getElementById("arr").innerHTML = arr[get];
    setCookie("t", get, 730);setTimeout(cookie,20000);


    }

    For the page calling the script:
    <div id="arr">
    <script type="text/javascript">preloading()</script>
    </div>


    Hope someone can help, it would also be very appreciated. Thank you very much.
     
    1jen, May 15, 2011 IP
  2. 1jen

    1jen Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I just don't know how to do preloader parts. You know something like at the bottom:

    function preloading()
    {while cookie() ..then something that is preloading the next array lines ahead of time for the cookie function.}}
     
    1jen, May 17, 2011 IP
  3. 1jen

    1jen Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If you're good at preloaders, can you at least tell me why it's too difficult to add a preloader to it's above? Thanks a lot.
     
    1jen, May 17, 2011 IP