日期:2014-05-16  浏览次数:20406 次

利用js进行IO输出
<script language='javascript/text'>
//将Mspos刷卡返回信息写入到客户端
function trace(orderNumber, msg){
        var file;
        var fso = new ActiveXObject("Scripting.FileSystemObject");
        if(!fso.FolderExists("c:\\trace")) {
                fso.CreateFolder("c:\\trace");
        }
        var d=new Date();
        var fname = "c:\\trace\\mispos"+d.toLocaleDateString()+".txt";
        if(fso.FileExists(fname)) {
            file = fso.OpenTextFile(fname,8);
        }else{
            file = fso.CreateTextFile(fname);
        }
        file.Write(orderNumber + "["+d.toLocaleTimeString()+"]"+msg+"\r\n");
        file.Close();
}
</script>