Home > Web Front-end > JS Tutorial > What is the javascript delete function?

What is the javascript delete function?

藏色散人
Release: 2023-01-05 16:14:10
Original
4230 people have browsed it

javascript删除函数是指Delete函数,该函数用于删除指定的文件或文件夹,其使用语法如“object.Delete( force );”,其中参数object是必选项,应为File或Folder对象的名称。

What is the javascript delete function?

本文操作环境:windows7系统、javascript1.8.5版、Dell G3电脑。

JavaScript中Delete函数

  JavaScript中Delete函数是删除指定的文件或文件夹。

object.Delete( force );
Copy after login

  其中object是必选项。 应为 File 或 Folder 对象的名称。

  force是可选项。 Boolean 值,如果要删除设置了只读属性的文件或文件夹则为 True ;否则为 False (默认)。

  并且如果指定的文件或文件夹不存在,那么会产生一个错误。http://www.mlybyby.com

  JavaScript中Delete函数对于单个 File 或 Folder 产生的结果和使用 FileSystemObject.DeleteFile 或 FileSystemObject.DeleteFolder 所执行的操作结果一样。

  Delete 方法对于包含内容和不包含内容的文件夹不做区分。 删除指定的文件夹时不考虑是否包含了内容。

  下面的例子说明了 Delete 方法的用法。

  var fso, f;
  fso = new ActiveXObject("Scripting.FileSystemObject");
  f = fso.CreateTextFile("c:\\testfile.txt", true);
  f.WriteLine("This is a test.");
  f.Close();
  f = fso.GetFile("c:\\testfile.txt");
  f.Delete();
Copy after login

推荐学习:《javascript高级教程

The above is the detailed content of What is the javascript delete function?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template