Monday, March 22, 2010

ASP Procedures

In ASP you can call a JavaScript procedure from a VBScript and vice versa.
________________________________________

Procedures

The ASP source code can contain procedures and functions:

Example


<% sub vbproc(num1,num2) response.write(num1*num2) end sub %>



You can call a procedure like this:

Result: <%call vbproc(3,4)%>

Or, like this:

Result: <%vbproc 3,4%>





Insert the <%@ language="language" %> line above the tag to write the procedure/function in another scripting language:
Example
<%@ language="javascript" %>


<% function jsproc(num1,num2) { Response.Write(num1*num2) } %>



Result: <%jsproc(3,4)%>