Jump to content


Photo

SetTimeout Not working ...


  • Please log in to reply
No replies to this topic

#1 QUACK

QUACK
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 27 March 2006 - 10:12 PM

I am trying to retrieve multipule and refresh them all after 5 seconds.

        <div id="header">
            <img src="/images/heading3.gif">
        </div>
        <div class="news" id="news1"><!-- Empty div for dynamic content -->Loading news. please wait...</div>        
        <div class="news" id="news2"><!-- Empty div for dynamic content -->Loading news. please wait...</div>        
        <div class="news" id="news3"><!-- Empty div for dynamic content -->Loading news. please wait...</div>        

        
    </div>

<script type="text/javascript">
ajax_loadContent('news1--external/externalfile1.html');
ajax_loadContent('news2--external/externalfile2.html');
ajax_loadContent('news3--external/externalfile3.html');

function ajax_showContent(divId,ajaxIndex,data)

{

    document.getElementById(divId).innerHTML = dynamicContent_ajaxObjects[ajaxIndex].response;

    dynamicContent_ajaxObjects[ajaxIndex] = false;

    settimeout("ajax_loadContent('"+data+"')",5000);

}



function ajax_loadContent(data)

{
    data    = data.split ( '--' );

    var ajaxIndex = dynamicContent_ajaxObjects.length;

    dynamicContent_ajaxObjects[ajaxIndex] = new sack();

    dynamicContent_ajaxObjects[ajaxIndex].requestFile = data[ 1 ];    // Specifying which file to get

    dynamicContent_ajaxObjects[ajaxIndex].onCompletion = function(){ ajax_showContent(data[0],ajaxIndex,data); };    // Specify function that will be executed after file has been found

    dynamicContent_ajaxObjects[ajaxIndex].runAJAX();        // Execute AJAX function

}


It loads the 3 pages then stops, it doesent do it agian after 5 seconds. If anyone has a better way of doing it, im welcome to suggestions :D

thanks.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users