MACROMEDIA DREAMWEAVER 8-DREAMWEAVER API Spezifikationen Seite 277

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 692
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 276
The File I/O API 277
DWfile.read()
Availability
Dreamweaver 2
Description
Reads the contents of the specified file into a string.
Arguments
fileURL
The 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 null if the read fails.
Example
The following code reads the file mydata.txt and, if successful, displays an alert box 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
Moves the specified file to the Recycling Bin or Trash.
Arguments
fileURL
The argument, which is expressed as a file:// URL, is the file you want to remove.
Returns
true if the operation succeeds; false otherwise.
Example
The following example uses DWfile.getAttributes() to determine whether the file is read-only
and
confirm() 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);
}
}
}
Seitenansicht 276
1 2 ... 272 273 274 275 276 277 278 279 280 281 282 ... 691 692

Kommentare zu diesen Handbüchern

Keine Kommentare