global.asa:
<object runat="server" progid="htmlfile" id="doc" scope="Application"></object>test.asp:
<script runat="server" language="livescript">
function Application_OnStart() {
initIE();
}
function doTasks(addTask) {
addTask(function() {
var timer = setInterval(function() {
this.cc.counter = -~this.cc.counter;
if(this.cc.counter < 10) return;
clearInterval(timer); // 計數器達到10,取消定時任務
this.cc.counter = "Timer [" + timer + "] has clear.";
}, 1000);
});
}
// Init IE
function initIE() {
var doc = Application.StaticObjects("doc");
var data = { doc: doc };
var xml = doc.createElement("xml");
data.xml = xml.createElement("x");
data.xml.dataType = "bin.base64";
var win = doc.frames; win.cc = data;
doTasks(function(func) { win.eval("(" + func + ")")(); });
}
</script>
計數器:<%= Application.StaticObjects("doc").frames.cc.counter %>不斷重繪頁面,可以看到計數器每秒更新一次,直到計數器達到10。
可以利用這個特性做后臺計劃任務。好像php和其他語言都不具備此強大功能。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/76374.html
標籤:ASP
上一篇:CSS求助
下一篇:微信小程式資料傳輸wen't
