I'm using the following script, I need to reload it every 60 secondes.
How should I do this?

<script type='text/javascript'><!--//<![CDATA[
   document.MAX_ct0 ='{clickurl}';

   var m3_u = (location.protocol=='https:'?'':'');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
   document.write ("?zoneid=3");
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
   document.write ("&amp;loc=" + escape(window.location));
   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
   if (document.context) document.write ("&context=" + escape(document.context));
   if ((typeof(document.MAX_ct0) != 'undefined') && (document.MAX_ct0.substring(0,4) == 'http')) {
       document.write ("&amp;ct0=" + escape(document.MAX_ct0));
   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
   document.write ("'></scr"+"ipt>");
Who is Participating?
You can use the setTimeout and setInterval functions in a loop. setTimeout is not a blocking call, and hence is not equivalent to the sleep() function in most other languages. You will need to write code to keep the script "occupied doing nothing" until the timeout event is notified. Not ideal, but no other option in Javascript.

Alternatively you can use the Refresh meta to get the browser to reload the page every n seconds. But this will trigger a refresh in the browser and a call to the server.

- Ravs
Michel PlungjanIT ExpertCommented:
Put the script in a piece of html in an iframe and reload the iframe

function reloadIf() {
var tId = "";
<iframe src="ad.html" onLoad="parent.tId=setInterval('parent.reloadIf()',60000)"></iframe>
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.