The File I/O API
27
Arguments
fileURL
,
text
,
{mode}
■
The
fileURL
argument, which is expressed as a file:// URL, is the file to which you are
writing.
■
The
text
argument is the string to be written.
■
The
mode
argument, if it is supplied, must be
"append"
. If this argument is omitted, the
contents of the file are overwritten by the string.
Returns
A Boolean value:
true
if the string is successfully written to the file;
false
otherwise.
Example
The following code attempts to write the string
"xxx"
to the mydata.txt file and displays an
alert message if the write operation succeeds. It then tries to append the string
"aaa"
to the
file and displays a second alert if the write succeeds. After executing this script, the mydata.txt
file contains the text
xxxaaa
and nothing else.
var fileURL = "file:///c|/temp/mydata.txt";
if (DWfile.write(fileURL, "xxx")){
alert("Wrote xxx to " + fileURL);
}
if (DWfile.write(fileURL, "aaa", "append")){
alert("Appended aaa to " + fileURL);
}
000_DW_API_Print.book Page 27 Wednesday, July 20, 2005 11:58 AM
Содержание DREAMWEAVER 8-DREAMWEAVER API
Страница 1: ...Dreamweaver API Reference...
Страница 16: ......
Страница 28: ...28 The File I O API...
Страница 38: ...38 The HTTP API...
Страница 68: ...68 Flash Integration...
Страница 100: ...100 The Database API...
Страница 116: ...116 The JavaBeans API...
Страница 144: ...144 The Source Control Integration API...
Страница 146: ......
Страница 254: ...254 Workspace...
Страница 298: ...298 Site...
Страница 354: ...354 Document...
Страница 396: ...396 Page Content...
Страница 488: ...488 Design...
Страница 550: ...550 Code...