Recommended: Calculation method for data addition and subtraction in ASP date format In ASP, we provide special date addition and subtraction functions. 1. DateAdd function returns the date where the specified time interval has been added. DateAdd(interval,number,date) The syntax of the DateAdd function has the following parameters (1) interval required. A string expression that indicates the time interval to be added. For values, see the Settings section.
ASP programs can call subroutines through VBScript and other ways.Calling a subroutine using VBScript, sample code:
| <html> <head> <% subvbproc(num1,num2) response.write(num1*num2) endsub %> </head> <body> <p>You can call a program like this:</p> <p>Result: <%callvbproc(3,4)%></p> <p>Or, like this:</p> <p>Result: <%vbproc3,4%></p> </body> </html> |
Calling a subroutine using JavaScript, sample code:
| <%@language=javascript%> <html> <head> <% functionjsproc(num1,num2) { Response.Write(num1*num2) } %> </head> <body> <p> Result: <%jsproc(3,4)%> </p> </body> </html> |
Calling subroutines using VBScript and JavaScript, sample code:
| <html> <head> <% subvbproc(num1,num2) Response.Write(num1*num2) endsub %> <scriptlanguage=javascriptrunat=server> functionjsproc(num1,num2) { Response.Write(num1*num2) } </script> </head> <body> <p>Result: <%callvbproc(3,4)%></p> <p>Result: <%calljsproc(3,4)%></p> </body> </html> |
The ASP source code can contain subroutines and functions:
| <html> <head> <% subvbproc(num1,num2) response.write(num1*num2) endsub %> </head> <body> <p>Result:<%callvbproc(3,4)%></p> </body> </html> |
Write the line <%@language=language%> to the <html> tag, and you can use another scripting language to write subroutines or functions:
| <%@language=javascript%> <html> <head> <% functionjsproc(num1,num2) { Response.Write(num1*num2) } %> </head> <body> <p>Result:<%jsproc(3,4)%></p> </body> </html> |
Differences between VBScript and JavaScript
When calling VBScript or JavaScript subroutines from an ASP file written in VBScript, you can use the keyword call, followed by the subroutine name. If the subroutine requires parameters, when using the keyword call, the parameters must be surrounded by brackets. If call is omitted, the parameters do not have to be surrounded by brackets. If the subroutine has no parameters, then brackets are optional. When calling VBScript or JavaScript subroutine from an ASP file written in JavaScript, parentheses must be used after the subroutine name.
Share: How to generate pictures from digital images in web pages Save the following code as myimg.asp, and insert imgsrc=myimg.asp?tel=010-0000000 at the position where the number to be displayed (such as QQ number, etc.). % CallCom_CreatValidCode(Request.QueryString(tel)) PublicSubCom_CreatValidCode(pTel) '----------禁止缓存Response.Expires=0 Response.