使用Trim
Trimming 串是你想要在开始就获得的东西。很多时候,一个串在开始或者结束的时候有一个额外的空间,如果你不平衡它,你可能会担心浪费时间到这些变量上。作者: superadmin 时间: 2007-9-26 21:55
<% strName = Request.Form("Name")
strCheckName = "Amy Cowen"
If strName = strCheckName THEN
Response.Write "Success! The names matched."
Else
Response.Write "Sorry. The names do not match."
End if
%>
Request.QueryString:
使用FileSystemObject, 你可以测试一个文本—比如, *.html, *.asp, *.inc., *.gif—或者目录的存在。如果文件存在,你可以想要一连串的时间发生。如果文件不存在,你可能需要其他的事件发生,使用下面的代码: <%
sPath="/profiles/" & strFileName & ".asp"
sFile=Server.MapPath(sPath)
Set fe=Server.CreateObject("Scripting.FileSystemObject")
if fe.FileExists(sFile) THEN
'do something
Response.Write "Yeah! I found it!."
Response.Write "You can access that file by "
Response.Write "<A HREF=""" & sPath & """>Clicking Here</A>."
else
'do something
Response.Write "Sorry. The requested file does not exist."
end if
%>
为了简单的测试你这个文件,添加脚本到最上面:
strFileName = "name"
' First assign the name of a file you have to this variable.
' strFileName holds just the name, not the extension or the path.
' Make sure you change the path for sPath to the virtual directory your file is in
' Run the script.
' Then come back and change the strFileName variable to the name of a file
' you do NOT have.
' Run the script.作者: superadmin 时间: 2007-9-26 21:55
改变被输入的代码为一个整型是非常容易的并且可以让你以后的工作变得容易一点,样本的格式是这样的:
<%
dim intUserID intUserID = Request.QueryString("userID")
intUserID = CInt(intUserID)
' intUserID is now an integer.
%>