Guest Teddy4z Posted February 25, 2006 Share Posted February 25, 2006 Can anybody tell me how to open a text file and write text into it using javascript? Link to comment Share on other sites More sharing options...
scott100 Posted February 26, 2006 Share Posted February 26, 2006 AFAIK JavaScript cannot read or write with text files , PHP or ASP etc can do Link to comment Share on other sites More sharing options...
aspnetguy Posted February 27, 2006 Share Posted February 27, 2006 AFAIK JavaScript cannot read or write with text files , PHP or ASP etc can do<{POST_SNAPBACK}> JS can read and write text files (pretty sure) but ti is client side. It wouls be trying to read or write tot he clients pc not hte server. Link to comment Share on other sites More sharing options...
Pollux Posted February 27, 2006 Share Posted February 27, 2006 Javascript has no support for reading or writing files on either the server or local system. There are a couple of sketchy work arounds for IE using jscript and ActiveX but they're generally not very reliable and aren't cross browser. The exception is cookies which you can both read and write. This will be fine if you want to store some value or setting for each user, which you can reload on their next visit. Read the JS Cookies article for how to use them. Link to comment Share on other sites More sharing options...
aspnetguy Posted February 27, 2006 Share Posted February 27, 2006 Javascript has no support for reading or writing files on either the server or local system. There are a couple of sketchy work arounds for IE using jscript and ActiveX but they're generally not very reliable and aren't cross browser. The exception is cookies which you can both read and write. This will be fine if you want to store some value or setting for each user, which you can reload on their next visit. Read the JS Cookies article for how to use them.<{POST_SNAPBACK}> There you go...wrong again ... keeps me humble, lol Link to comment Share on other sites More sharing options...
aspnetguy Posted February 27, 2006 Share Posted February 27, 2006 You could read a text file (would be cross browser) if you set the src of a hidden iframe to the path of the text file then read the ocontents of the frame.As far as writeing ot a file you would need ActiveX which as was said is not cross browser. Link to comment Share on other sites More sharing options...
DarkElf Posted February 27, 2006 Share Posted February 27, 2006 I would use php for this, infact It sound's a little like you want to do something fairly similar to something I've done myself with php. Could you post this question in the php forum and give a little more details about what exactly you are trying to acheive? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now