[問題] 請問javascript寫檔問題

看板Web_Design作者 (夢想。追逐)時間15年前 (2011/03/16 21:03), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/1
我想要寫一個可以在網頁關閉時就 紀錄當前時間並寫入文字檔 但是不知為何 一直沒出現文字檔...不知道是哪邊出了問題呢? 我剛接觸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
檔案應該要寫在server上~js是client另資料夾權限要開
03/17 13:44, 1F
文章代碼(AID): #1DWBKUnr (Web_Design)