推薦:解讀asp調用子程序教程ASP程序可通過VBScript和其他方式調用子程序。 調用使用VBScript的子程序,示例代碼: html head % subvbproc(num1,num2) response.write(num1*num2) endsub % /head body p您可以像這樣調用一個程序:/p p結果:%callvbproc(3,4)%/p p或者,像這樣:/p p結果
指定的驅動器存在嗎?<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> |
<html> <body> <% Set fs=Server.CreateObject("Scripting.FileSystemObject") p=fs.GetDriveName("c:/windows/cursors/abc.cur") Response.Write("驅動器名稱是:" & p) set fs=nothing %> </body> </html> |
<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> |
<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> |
<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> |
<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> |
<html> <body> <% Set fs=Server.CreateObject("Scripting.FileSystemObject") Response.Write("這個文件名的最后一個成分是:") Response.Write(fs.GetFileName("c:/windows/cursors/abc.cur")) set fs=nothing %> </body> </html> |
<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 |
分享:解析ASP日期格式的數據加減計算方法在ASP中為我們提供了專門的日期加減函數。 1.日期相加 DateAdd函數 返回已添加指定時間間隔的日期。 DateAdd(interval,number,date) DateAdd函數的語法有以下參數 (1)interval必選項。字符串表達式,表示要添加的時間間隔。有關數值,請參閱“設置”部分。
新聞熱點
疑難解答