巧妙的让web来执行“计划任务”(转 biyuan老矣 )

updateIndex.asp:

<scrīpt language="Jscrīpt" runat="server">
var
fso = new ActiveXObject("scrīpting.FileSystemObject"
);
var
fts = fso.GetFile(Server.MapPath("index.shtml"
));

var
s = new Date(fts.DateLastModified).getDate
();
fso = null
;
var
t = new Date().getDate
();

if(
s == t
){
    
Response.Write("var typeString = '你找到这里来干嘛?';"
);
    
Response.End
();
}
else{
    
//省略生成index.shtml的代码
    
Response.Write("setTimeout(\"parent.location.reload();\",5000);"
);
    
Response.End
();
}
</scrīpt>

在index.shtml页面引用方式:

<scrīpt language="Javascrīpt" src="updateIndex.asp"></scrīpt>

posted @ 2007-05-15 23:26  过河卒A  阅读(407)  评论(2编辑  收藏  举报