ASP Basic Tutorial: Learning the application of the ASP neutron program

Source: Internet
Author: User
Tags end functions

In ASP, you can invoke the program from VBScript and other means.

Instance:

Calling subroutines that use VBScript

How to invoke a subroutine written in VBScript from an ASP.

The following are the referenced contents:

<%
Sub Vbproc (NUM1,NUM2)
Response.Write (NUM1*NUM2)
End Sub
%>

<body>
<p>
Can call a procedure as this:
</p>
<p>
Result: <%call vbproc (3,4)%>
</p>
<p>
Or, like this:
</p>
<p>
Result: <%vbproc 3,4%>
</p>
</body>

How to invoke a subroutine written in JavaScript from an ASP.
<%@ language= "JavaScript"%>
<%
function Jsproc (num1,num2)
{
Response.Write (NUM1*NUM2)
}
%>
<body>
<p>
Result: <%jsproc (3,4)%>
</p>
</body>

Calling subroutines that use VBScript and JavaScript
How to invoke subroutines written in VBScript and JavaScript in an ASP file. <%
Sub Vbproc (NUM1,NUM2)
Response.Write (NUM1*NUM2)
End Sub
%>
<script language= "javascript" runat= "Server" >
function Jsproc (num1,num2)
{
Response.Write (NUM1*NUM2)
}
</script>
<body>
<p>result: <%call vbproc (3,4)%></p>
<p>result: <%call jsproc (3,4)%></p>
</body>
Sub Programs
ASP source code can contain subroutines and functions:

<%
Sub Vbproc (NUM1,NUM2)
Response.Write (NUM1*NUM2)
End Sub
%>
<body>
<p>result: <%call vbproc (3,4)%></p>
</body>
By writing <%@ language= "language"%> this line above the

<%@ language= "JavaScript"%>
<%
function Jsproc (num1,num2)
{
Response.Write (NUM1*NUM2)
}
%>
<body>
<p>result: <%jsproc (3,4)%></p>
</body>

the difference between VBScript and JavaScript

When you invoke 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, you must surround the arguments with parentheses when using the keyword "call". If "Call" is omitted, the argument does not have to be surrounded by parentheses. If the subroutine has no arguments, then the parentheses are optional.

When you call VBScript or JavaScript subroutines from an ASP file written in JavaScript, you must use parentheses after the subroutine name.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.