[問題] 請問javascript寫檔問題
我想要寫一個可以在網頁關閉時就 紀錄當前時間並寫入文字檔
但是不知為何 一直沒出現文字檔...不知道是哪邊出了問題呢?
我剛接觸js 看了好幾天 問了很多人都沒頭續..
希望有好心人幫我看看哪裡出了問題 感激不盡 謝謝!!!
<html>
<script language="javascript">
function WriteToFile() { //寫檔的函式
var objFSO = new ActiveXObject('Scripting.FileSystemObject');
var dateObj = new Date();
var temp ='';
temp = temp + dateObj.getYear();
temp = temp + dateObj.getMonth();
temp = temp + dateObj.getDate();
temp = temp + dateObj.getHours();
temp = temp + dateObj.getMinutes();
temp = temp + dateObj.getSeconds();
var objStream=objFSO.OpenTextFile("test.txt",ForWriting,true,false);
objStream.WriteLine(temp);
objStream.Close();
}
</script>
<head>
</head>
<body onbeforeunload="WriteToFile()"> //由這個函式判斷離開網頁 載入函式
</body>
</html>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.25.187.129
→
03/17 13:44, , 1F
03/17 13:44, 1F