setTimeout只執行一次:
<script>
//定時器 異步運行
function hello(){
alert("hello");
}
//使用方法名字執行方法
var t1 = window.setTimeout(hello,1000);
var t2 = window.setTimeout("hello()",3000);//使用字符串執行方法
window.clearTimeout(t1);//去掉定時器
</script>
setInterval指定時間循環執行:
//實時刷新時間單位爲毫秒
setInterval('refreshQuery()',8000);
/* 刷新查詢 */
function refreshQuery(){
$("#mainTable").datagrid('reload',null);
}