|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi
First of all, let me tell you that this is not a homework question, since i am no longer in college, i don't get homework. Ok now to the question => Can you please give me a little example java script to open and save text files Thank you in advance |
|
|||
|
If the file is on the same server, you can read it using XHR and use the responseText property to get at the contents. If you’re a prototype user, it would look like this:
new Ajax.Request(‘myfile.txt’, { onComplete: function (transport) { alert(transport.responseText); } }); |
|
||||
|
Microsoft allows JScript to access the operating system shell to perform commands on the local machine - though I wouldn't recommend using this technique for websites as the browser will either ignore the script, throw errors, or present users with an ominous security dialog.
__________________
Dan LeFree | Product Manager (Linux VPS Hosting) | Owner/Operator (Web development, marketing) |
|
||||
|
If you are looking for a way to preserve data between site visits - you could use JavaScript to create a cookie. It can contain roughly 4Kb, that's quite a lot of text.
__________________
There are 10 types of people in this world: those who understand binary and those who don't. |
|
||||
|
as freezea sort of mentioned...you could use ajax which stands for asynchronous JavaScript + XML.
I'm not sure if you can open text files but I believe you can. If not someone else will clarify this for you. The only thing is you're going to have to find a ajax script that sort of does what you want and hack (edit) it to your desires.
__________________
Join free dating sites and meet single people without paying a penny. |
|
||||
|
...and we've all jumped in and assumed you meant JavaScript (looking at your post maybe you meant Java). What exactly do you need to do with this NOT homework.
__________________
There are 10 types of people in this world: those who understand binary and those who don't. |
|
||||
|
Quote:
wow, actually you can't open a local text file with ajax...I just searched around and found nothing that proves you can either... my wrong...
__________________
Join free dating sites and meet single people without paying a penny. |
|
||||
|
You can't do any file stuff on the client because it would be an horrendous security violation. It is possible to get access to the clipboard on the client, although this too should be totally blocked for security reasons. If you use Firefox, they quite rightly make it extremely difficult to allow. If you are an IE user, you can let any web site have access to your clipboard simply by answering yes to the alert that pops up when something tries to access your clipboard!
You can do all file operations on the server using AJAX; save and read files there and pass the contents down to the client. |
|
|||
|
|
|
||||
|
Hmm.
Except your first link says use an ActiveX control (which is nothing to do with Javascript). Your second and third links basically reiterate what has been said above. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can Flash files open up in own window | Photoartomation | Graphics & Design Discussion Forum | 6 | 09-17-2009 11:55 AM |
| JavaScript Remote Scripting: Processing XML Files | WPW_Feedbot | Graphics & Design Discussion Forum | 0 | 10-10-2005 04:09 AM |
| Windows 2000 Slow with File Open and File Save Dialog Boxes | steve0 | IT Discussion Forum | 2 | 09-15-2005 06:27 PM |
| Will Text Ads Save Broadband Content Partnerships? | WPW_Feedbot | Marketing Strategies Discussion Forum | 0 | 01-18-2005 05:30 PM |
| Does PS save support .bak files? | matauri | Graphics & Design Discussion Forum | 1 | 05-10-2004 06:06 PM |
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |