Adobe Dreamweaver API Reference CS5 Instrukcja Użytkownika Strona 16

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 533
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 15
11
DREAMWEAVER API REFERENCE
The file I/O API
Last updated 8/27/2013
Arguments
fileURL
The fileURL argument, which is expressed as a file:// URL, is the file you want to read.
Returns
A string that contains the contents of the file or a null value if the read fails.
Example
The following code reads the mydata.txt file and, if it is successful, displays an alert message with the contents of the file:
var fileURL = "file:///c|/temp/mydata.txt";
var str = DWfile.read(fileURL);
if (str){
alert(fileURL + " contains: " + str);
}
DWfile.remove()
Availability
Dreamweaver 3.
Description
This function deletes the specified file.
Arguments
fileURL
The fileURL argument, which is expressed as a file:// URL, is the file you want to remove.
Returns
A Boolean value: true value if the operation succeeds; false otherwise.
Example
The following example uses the DWfile.getAttributes() function to determine whether the file is read-only and
the
confirm() function to display a Yes/No dialog box to the user:
function deleteFile(){
var delAnyway = false;
var selIndex = document.theForm.menu.selectedIndex;
var selFile = document.theForm.menu.options[selIndex].value;
if (DWfile.getAttributes(selFile).indexOf('R') != -1){
delAnyway = confirm('This file is read-only. Delete anyway?');
if (delAnyway){
DWfile.remove(selFile);
}
}
}
Przeglądanie stron 15
1 2 ... 11 12 13 14 15 16 17 18 19 20 21 ... 532 533

Komentarze do niniejszej Instrukcji

Brak uwag