How JavaScript uses FileSystemObject objects to write text file content _javascript tips

Source: Internet
Author: User

This example describes how JavaScript uses the FileSystemObject object to write the contents of a text file. Share to everyone for your reference. Specifically as follows:

This code is mainly to practice JavaScript FileSystemObject object, use it to let JavaScript write to a text file content, this TXT file path you can specify, and then define what to write, run the code, You will find that the contents of the original TXT text have changed.

The effect is as shown in the following illustration:

The specific code is as follows:

 
 

However, in some cases the browser will complain that the object could not be created.

F12 developer Mode Debugging Discovery: The Automation server failed to create the object when it ran to the new ActiveXObject.

Workaround:

IE browser-> tool->internet option-> security-> Custom Level-> settings

-> "Initialize and execute scripts for ActiveX controls not marked as safe for scripting" is set to Enabled, OK.

Attention:

Enabling this option is only available for debugging local code and must be remembered before accessing other web sites.
Otherwise malicious script will be through IE with read, write, traverse your local files and so on all the permissions!

I hope this article will help you with your JavaScript programming.

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.