Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 12-17-2005, 08:36 PM   #1
Beta Member
 
Join Date: Dec 2005
Posts: 2
Question Help with Javascript.

This code is supposed to save to a file.

Code:
function SaveAsFile(){
  SaveFrame.document.open('text/html',"replace")
  SaveFrame.document.charset="UTF-8";
  SaveFrame.document.write("TESTTESTTESTTESTTEST")
  SaveFrame.document.close()
  SaveFrame.focus()
  SaveFrame.document.execCommand('SaveAs',1,"C:\\test.txt")
}

...

<iframe id="SaveFrame" style="display:none"></iframe>
But it inserts invisible (in Notepad), unsolicited characters. (The filesize is larger than it should be)

Edit: For Internet Explorer.
__________________

gggggg is offline   Reply With Quote
Old 12-19-2005, 08:57 AM   #2
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,003
Default Re: Help with Javascript.

I tried this code...


file size for me is 20 bytes...

there are 20 bytes in this
Quote:
TESTTESTTESTTESTTEST
so it seem to be working as expected?
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 01:23 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0