QUACK Posted March 27, 2006 Share Posted March 27, 2006 I am trying to retrieve multipule and refresh them all after 5 seconds.[code] <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');[/code][code]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}[/code]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 :Dthanks. Quote Link to comment https://forums.phpfreaks.com/topic/5969-settimeout-not-working/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.