推荐:ASP实例教程:Form集合Form集合 注意因为本ASP实例教程是关于表单的代码,为了省事,所以我不截图了!大家自行测试实例执行结果! 一个Form集合的简单应用 本例演示Form集合如何从表单取回值。此表单使用POST方法,这意味着发送的信息对用户来说是不可见的,并且对对所发送信息的
FileSystemObject 对象
指定的文件存在吗?
本例演示如何首先创建FileSystemObject对象,然后使用FileExists方法来探测某文件是否存在。
本示例代码如下:
| 以下为引用的内容: <html> <body> <% Set fs=Server.CreateObject(Scripting.FileSystemObject) If (fs.FileExists(c:/windows/cursors/xxx.cur))=true Then Response.Write(文件 c:/windows/cursors/xxx.cur 存在。) Else Response.Write(文件 c:/windows/cursors/xxx.cur 不存在。) End If set fs=nothing %> </body> </html> |
本实例运行结果如下:
文件 c:/windows/cursors/xxx.cur 不存在。
指定的文件夹存在吗?
本例演示如何使用FolderExists方法探测某文件夹是否存在。
本示例代码如下:
| 以下为引用的内容: <html> <body> <% Set fs=Server.CreateObject(Scripting.FileSystemObject) If fs.FolderExists(c:/temp) = true Then Response.Write(文件夹 c:/temp 存在。) Else Response.Write(文件夹 c:/temp 不存在。) End If set fs=nothing %> </body> </html> |
本实例运行结果如下:
文件夹 c:/temp 不存在。
指定的驱动器存在吗?
本例演示如何使用DriveExists方法来探测某个驱动器是否存在。
本示例代码如下:
| 以下为引用的内容: <html> <body> <% Set fs=Server.CreateObject(Scripting.FileSystemObject) if fs.driveexists(c:) = true then Response.Write(驱动器 c: 存在。) Else Response.Write(驱动器 c: 不存在。) End If Response.write(<br>) if fs.driveexists(g:) = true then Response.Write(驱动器 g: 存在。) Else Response.Write(驱动器 g: 不存在。) End If set fs=nothing %> </body> </html> |
本实例运行结果如下:
驱动器 c: 存在。
驱动器 g: 存在。
取得某个指定驱动器的名称
本例演示如何使用GetDriveName方法来取得某个指定的驱动器的名称。
本示例代码如下:
| 以下为引用的内容: <html> <body> <% Set fs=Server.CreateObject(Scripting.FileSystemObject) p=fs.GetDriveName(c:/windows/cursors/abc.cur) Response.Write(驱动器名称是: & p) set fs=nothing %> </body> </html> |
本实例运行结果如下:
驱动器名称是:c:
取得某个指定路径的父文件夹的名称
本例演示如何使用GetParentFolderName方法来取得某个指定的路径的父文件夹的名称。
本示例代码如下:
| 以下为引用的内容: <html> <body> <% Set fs=Server.CreateObject(Scripting.FileSystemObject) p=fs.GetParentFolderName(c:/winnt/cursors/3dgarro.cur) Response.Write(c:/windows/cursors/abc.cur 的父文件夹名称是: & p) set fs=nothing %> </body> </html> |
本实例运行结果如下:
c:/windows/cursors/abc.cur 的父文件夹名称是:c:/winnt/cursors
取得文件夹扩展名
本例演示如何使用GetExtensionName方法来取得指定的路径中的最后一个成分的文件扩展名。
本示例代码如下:
| 以下为引用的内容: <html> <body> <% Set fs=Server.CreateObject(Scripting.FileSystemObject) Response.Write(文件 3dgarro 的文件扩展名是:) Response.Write(fs.GetExtensionName(c:/windows/cursors/abc.cur)) set fs=nothing %> </body> </html> |
本实例运行结果如下:
文件 3dgarro 的文件扩展名是:cur
取得文件名
本例演示如何使用GetFileName方法来取得指定的路径中的最后一个成分的文件名。
本示例代码如下:
| 以下为引用的内容: <html> <body> <% Set fs=Server.CreateObject(Scripting.FileSystemObject) Response.Write(这个文件名的最后一个成分是:) Response.Write(fs.GetFileName(c:/windows/cursors/abc.cur)) set fs=nothing %> </body> </html> |
本实例运行结果如下:
这个文件名的最后一个成分是:abc.cur
取得文件或文件夹的基名称
本例演示如何使用GetBaseName方法来返回在指定的路径中文件或者文件夹的基名称。
本示例代码如下:
| 以下为引用的内容: <html> <body> <% Set fs=Server.CreateObject(Scripting.FileSystemObject) Response.Write(fs.GetBaseName(c:/windows/cursors/abc.cur)) Response.Write(<br />) Response.Write(fs.GetBaseName(c:/windows/cursors/)) Response.Write(<br />) Response.Write(fs.GetBaseName(c:/windows/)) set fs=nothing %> </body> </html> |
本实例运行结果如下:
| 以下为引用的内容: abc cursors windows |
分享:比较几款Access在线管理工具ACCESS数据库现在在个人站长使用的频率还是很高的,所以各款 ACCESS 在线管理工具也应运而生,我们来看看现在几款比较流行的优劣: 我们来评评以下几款工具:亘古 Access 在线管理,虎冀阁 Access 数据库管理工具,access2008.cn ACCESS 数据库在线管理系统