Recommended: Introduction to the collection, properties and methods of Response objects in ASP The Response object responds to an HTTP response, through which properties and methods can control how the server's data is sent to the client browser. When using Response objects in ASP scripts, the following syntax format is followed: Response. Collection name Response. Attribute name Response. Method name Response object has only one Cookies collection, each of the collection
1. Function array()
Function: Create an array variable
Format: array(list)
Parameter: list is each numeric column in the array variable, with comma intervals in the middle
example:
<% i = array (1,2,3) %>
Result: i is assigned as an array
2. Function Cint()
Function: Convert an expression/other type of variable into an integer type (int)
Format: Cint(expression)
Parameter:expression is any valid expression/other type variable
example:
<%
f = 234
response.write cINT(f) + 2
%>
Results: 236
The function Cint() converts the character 234 into an integer 234. If the expression is empty or invalid, the return value is 0;
3. Function: Creatobject()
Function: Create and return an ActiveX object.
Format: Creatobject(obname)
Parameter:obname is the name of the object
example:
<%
Set con = Server.createObject(ADODB.Connection)
%>
result:
4. Function Cstr()
Function: Convert an expression/other type of variable into a character type (string)
Format: Cstr(expression)
Parameters: expression is any valid expression/other type variable
example:
<%
s = 3 + 2
response.write The result is: & cStr(s)
%>
Result: The function Cstr() converts integer 5 into character 5.
5. Function Date()
Function: Return the date of the current system (server side)
Format: Date()
Parameters: None
Example <% date () %>
Results: 05/10/00
6. Function Dateadd()
Function: Calculate a specified time and
Format: dateadd(timeinterval,number,date)
Parameters: timeinterval is the time unit (month, day...); number is the time interval value, and date is the time starting point.
example:
<%
currentDate = #8/4/99#
newDate = DateAdd(m,3,currentDate)
response.write newDate
%> <%
currentDate = #12:34:45 PM#
newDate = DateAdd(h,3,currentDate)
response.write newDate
%>
result:
11/4/99
3:34:45 PM
in
m = month;
d = day;
If it is the currentDate format, then,
h = hour;
s = second;
7. Function Datediff()
Function: Calculate a specified time difference of a certain quantity
Format: datediff(timeinterval,date1,date2[,firstdayofweek[,firstdayofyear]])
Parameters: timeinterval is the time unit; date1 and date2 are valid date expressions, firstdayofweek, firstdayofyear are any options.
example:
<%
fromDate = #8/4/99#
toDate = #1/1/2000#
response.write There are & _
DateDiff(d,fromDate,toDate) & _
days to millionium from 8/4/99.
%>
Results: There are 150 days to millionium from 8/4/99.
8. Function day()
Function: Return an integer value corresponding to a day of a certain month
Format: day(date)
Parameters: date is a valid date expression;
Example lt;% =date(#8/4/99#) %>
Results: 4
9. Function formatcurrency()
Function: Convert to currency format
Format: formatcurrency(expression [,digit[,leadingdigit[,paren[,groupdigit]]]])
Parameters: expression is a valid numeric expression; digit represents the number of digits after the decimal point; leadingdigit, paren, groupdigit are any options.
Example <%=FormatCurrency(34.3456)%>
Results 34.35
10. Function Formatdatetime()
Function: Format date expression/variable
Format: formatdatetime(date[,nameformat])
Parameters: date is a valid date expression/variable; nameformat is the specified date format constant name.
Example <% =formatdatetime(08/04/99,vblongdate) %>
Results: Wednesday, August 04,1999
21. Function Isnumeric()
Function: Return a Boolean value to determine whether the variable is a numeric variable, or other variables that can be converted into numbers.
Format: isnumeric(expression)
Parameter:expression is an arbitrary variable.
example:
<%
i=234
response.write isnumeric(i)
%>
Result: true.
22. Function Isobject()
Function: Return a Boolean value to determine whether the variable is an object variable,
Format: isobject(expression)
Parameter:expression is an arbitrary variable.
example:
<%
set con =server.creatobject(adodb.connection)
response.write isobject(con)
%>
Result: true
23. Function: Lbound()
Function: Return the lower bound of an array.
Format: Lbound(arrayname[, dimension])
Parameter: arrayname is an array variable, dimension is any item
example:
<%
i = array(1,2,3)
response.write lbound(i)
%>
Results: 0
24. Function Lcase()
Function: Transform all characters of a character type variable into lowercase characters.
Format: Lcase(string)
Parameter: string is a string variable
example:
<%
str=THIS is Lcase!
response.write Lcase(str)
%>
Result: this is lcase!
25. Function left()
Function: Intercept the first part of a string;
Format: left(string, length)
Parameters: string string, length intercepted by length.
Example: <% =left(this is a test!,6) %>
Results: this i
26. Function len()
Function: Return the string length or the byte length of the variable
Format:len(string |varname)
Parameter: string; varname any variable name
example:
<%
strtest=this is a test!
Share: Use of MsgBox function and InputBox function in ASP The MsgBox function displays a message in the dialog box, waiting for the user to click the button, and returns a value to indicate the button that the user clicks. The syntax format is as follows: MsgBox(prompt[,buttons][,title][,helpfile,context]) prompt: Specify the string buttons displayed in the dialog box: Specify the number and type of buttons displayed, the icon style used, the default value is 0 (parameters