开发者

div refresh without click of the button

how 开发者_开发百科do i make the div refresh, say after 10 secs and execute the run_query() function without clicking on the button?

<script src="scripts/ajax.js" type="text/javascript"></script> 



<div id="quote"><strong>Quote of the Day</strong></div>
<div><a style="cursor:pointer" onclick="run_query()">Next quote …</a></div>


Use setInterval function.

setInterval(function(){run_query();}, 10000);

For the initial load you can do that from the server side code.


setTimeout("run_query()",10000);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜