JavaScript uses FileSystemObject object to write the content of a text file. filesystemobject

Source: Internet
Author: User

JavaScript uses FileSystemObject object to write the content of a text file. filesystemobject

This example describes how to use a FileSystemObject object to write text files in JavaScript. Share it with you for your reference. The details are as follows:

This code is mainly used to practice the JavaScript FileSystemObject object, which allows JavaScript to write content to a text file. You can specify the path of this TXT file by yourself, then define the content to be written and run the code. You will find that the content in the original TXT text has changed.

Shows the running effect:

The Code is as follows:

<Html> 

However, in some cases, the browser reports an error and fails to create an object.

During debugging in F12 developer mode, the automation server fails to create an object when it runs to the new ActiveXObject line.

Solution:

Internet Explorer-> Tools-> Internet Options-> Security-> Custom Level-> Settings

-> Set "initialize and execute scripts for ActiveX controls that are not marked as secure scripts" to enable and confirm.

Note:

Enabling this option can only be used to debug local code. Remember to change it before accessing other websites.
Otherwise, malicious scripts will have all the permissions to read, write, and traverse your local files through IE!

I hope this article will help you design javascript programs.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.