File.Name
JScript3.0+Syntax
file.Name
Description
The Name property is used to either set or get the name of a file object.
Example
Listing 9.58 shows how the Name property is used to get the filename.
Listing 9.58 Example of Name Property
<html> <BODY> <script language="JScript"> <!-- Hide // function creates a new file and uses the name property // to display the name of the newly created file. function get() { var myObject, f; // Create an instance of the FileSystemObject myObject = new ActiveXObject("Scripting.FileSystemObject"); f = myObject.GetFile("c:\\test.txt"); alert("The name of the file is: " + f.Name); } //--> </script> <form name="myForm"> <INPUT type="Button" value="Get Name" onClick='get()'> </form> </BODY> </html> |
Get Pure JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.