Home > front end >  ASP in Global. Asa in run time task
ASP in Global. Asa in run time task

Time:09-18

Global. Asa:
 & lt; The object runat="server" progid="htmlfile" id="doc" scope="Application" & gt;  
<script runat="server" language="livescript & gt;"
The function the Application_OnStart () {
InitIE ();
}

The function doTasks (addTask) {
AddTask (function () {
Var timer=setInterval (function () {
This. Cc. Counter=- ~ this. Cc. The counter;
If (this. Cc counter & lt; 10) return;
clearInterval(timer);//counter reached 10, cancel the timer task
This. Cc. Counter="Timer [" + Timer +"] has clear. ";
}, 1000);
});
}

/IE/Init
The function initIE () {
Var doc=Application. StaticObjects (" doc ");
Var data={https://bbs.csdn.net/topics/doc: doc};
Var=XML doc. The createElement method (" XML ");
Data. XML=XML. CreateElement method (" x ");
Data, XML dataType="bin. Base64";
Var win=doc. Frames; Win. Cc=data;
DoTasks (function (func) {win. Eval (" (" + func + ") ") (); });
}
</script>
test. The asp:
 counter: & lt; %=Application. The StaticObjects (" doc ") frames. Cc. Counter % & gt; 

Constantly refresh the page, you can see the counter is updated once per second, until the counter reaches 10,
Can use this feature to do background planning tasks, like PHP and other languages don't have the power,
  •  Tags:  
  • ASP
  • Related