limited access to local files. With it, we can easily use pure JavaScript to achieve the local file read and upload. Currently, FireFox 3.6 is the first browser to support this feature. In addition, the latest version of the Google Chrome browser and Safari browser also have the corresponding support. The File API is
Javascript| Advanced
JavaScript is a Web page production can not be separated from the scripting language, relying on it, a Web page content is lively, full of vitality. But maybe you haven't found and applied some of its more advanced features? For example, files and folders to read, write and delete, as in VB, VC and other high-level languages often do the same
//JavaScript determines file type based on filenamevarImgext =NewArray (". png", ". jpg", ". jpeg", ". bmp", ". gif");//the suffix name of the picture filevarDocext =NewArray (". Doc", ". docx");//the suffix name of the Word filevarXlsext =NewArray (". xls", ". xlsx");//the suffix name of the Excel filevarCssext =NewArray (". css");//the suffix name of the CSS fi
I. function implementation core: FileSystemObject object
To implement file operations in javascript, FileSystemobject objects are primarily used.
Ii. FileSystemObject Programming
It is very easy to program with FileSystemObject object. Generally, the following steps are required: Create a FileSystemObject object, apply related methods, and access object attributes.
(1) create a FileSystemObject object
Only
content using the Read or ReadLine method, if you want to Skip some parts, you need to use the Skip or SkipLine method.
The following code demonstrates opening a file, entering data, and then reading data:
Var fso, f1, ts, s;
Var ForReading = 1;
Fso = new ActiveXObject ("Scripting. FileSystemObject ");
// Create a file
F1 = fso. CreateTextFile ("c: \ testfile.tx
Source
http://blog.csdn.net/baobao8505/article/details/740491
First, the function realizes the core: FileSystemObject objectTo implement the file manipulation function in JavaScript, the main thing is to rely on the FileSystemObject object.Second, FileSystemObject programmingProgramming with a FileSystemObject object is simple, typically through the following steps: Creating FileSystemObject objects, appl
read content is stored in a string variable for display, parsing. When reading a file's contents using the Read or ReadLine method, skip or SkipLine method is used if you want to skip some parts.
The following code shows opening the file, filling in the data, and then reading the data:
Var fso, F1, TS, s;
var ForReading = 1;
FSO = new ActiveXObject ("Scripting.F
Javascript file operations 1. function implementation core: FileSystemObject object
To implement file operations in javascript, FileSystemobject objects are primarily used.
Ii. FileSystemObject Programming
It is very easy to program with FileSystemObject object. Generally, the following steps are required: Create a Fil
Javascript file operations (IE)
I. function implementation core: FileSystemObject objectTo implement file operations in javascript, FileSystemobject objects are primarily used.Ii. FileSystemObject ProgrammingIt is very easy to program with FileSystemObject object. Generally, the following steps are required: Create a F
use the skip or skipline method.The following code demonstrates opening a file, entering data, and then reading data:VaR FSO, F1, ts, S;VaR forreading = 1;FSO = new activexobject ("scripting. FileSystemObject ");// Create a fileF1 = FSO. createtextfile ("C: \ testfile.txt", true );// Enter a data rowF1.writeline ("Hello World ");F1.writeblanklines (1 );// Close the fileF1.close ();// Open the fileTS = FSO. opentextfile ("C: \ testfile.txt", forreadin
your JavaScript file, and "functions" is the array of functions that exist in this JavaScript file.
As you can see, the code to pull and execute a script is straightforward. the browser first downloads, and then interprets the JavaScript
Javascript
JavaScript is a Web page production can not be separated from the scripting language, relying on it, a Web page content is lively, full of vitality. But maybe you haven't found and applied some of its more advanced features? For example, files and folders to read, write and delete, as in VB, VC and other high-level languages often do the same job. How
Javascript
JavaScript is a Web page production can not be separated from the scripting language, relying on it, a Web page content is lively, full of vitality. But maybe you haven't found and applied some of its more advanced features? For example, files and folders to read, write and delete, as in VB, VC and other high-level languages often do the same job. How
I. function implementation core: FileSystemObject objectTo implement file operations in javascript, FileSystemobject objects are primarily used.Ii. FileSystemObject ProgrammingIt is very easy to program with FileSystemObject object. Generally, the following steps are required: Create a FileSystemObject object, apply related methods, and access object attributes.(1) create a FileSystemObject objectOnly one l
, which is used to generate the Blob Object. This object can be read by FileReader like a File object. The two methods receive three parameters: 1st parameters are the starting position, 2nd are the Ending position, and when omitted, they are read to the end of the file; and 3rd are content type.For examples, see Readi
following code demonstrates opening a file, entering data, and then reading data:Var fso, f1, ts, s;Var ForReading = 1;Fso = new ActiveXObject ("Scripting. FileSystemObject ");// Create a fileF1 = fso. CreateTextFile ("c: \ testfile.txt", true );// Enter a data rowF1.WriteLine ("Hello World ");F1.WriteBlankLines (1 );// Close the fileF1.Close ();// Open the fileTs = fso. OpenTextFile ("c: \ testfile.txt", ForReading );//
string variable for display, parsing. When reading a file's contents using the Read or ReadLine method, skip or SkipLine method is used if you want to skip some parts.
The following code shows opening the file, filling in the data, and then reading the data:
Var fso, F1, TS, s;
var ForReading = 1;
FSO = new ActiveXObject ("Scripting.FileSystemObject");
Create a file
First, the function realizes the core: FileSystemObject object
To implement the file manipulation function in JavaScript, the main thing is to rely on the FileSystemObject object.
Second, FileSystemObject programming
Programming with a FileSystemObject object is simple, typically through the following steps: Creating FileSystemObject objects, applying related methods, and accessing object-related properties
In most cases, we do not need to determine whether the css file is successfully loaded. However, this function is still required for some time, today, I 've sorted out how to determine whether a CSS file is loaded in a variety of browsers. I 'd like to share with you how to determine whether the CSS file has been loaded. The practices of various browsers vary gre
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.