If you think that this site is helpful, please recommend your friends to visit our site.
How to creat a asp function?
The following is the code for creating asp function:
1. asp function with "function"
--------------------------------------------------------------------------------
< %
function Square(num)
Square = num * num
end function
'Returns 25
Response.Write(Square(5))
% >
--------------------------------------------------------------------------------
2. asp function with "sub"
--------------------------------------------------------------------------------
< %
sub ShowProfit(Revenue, Overhead, Commission, Admin)
'Create a variable to store our profit
Dim Profit
Profit = CDbl(Revenue - (Overhead + Commission + Admin))
Response.Write("$" & Profit)
end sub
'Call the sub with four parameters
'Will output $100.0
ShowProfit 150, 25, 10, 15
% >
--------------------------------------------------------------------------------
3. asp function without parameter
--------------------------------------------------------------------------------
< %
function show_message()
Response.Write("Display message with parameter")
end function
show_message
% >
No comments:
Post a Comment