软件教程

深入学习ASP中关于sub子程序的应用

来源: 本站    类别: 软件教程    日期: 2014/11/1

 

在ASP中,你可通过VBScript和其他方式调用自程序。
实例:

调用使用VBScript的子程序
    如何从ASP调用以VBScript编写的子程序。
     <html>

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

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

    </html>
调用使用JavaScript的子程序
    如何从ASP调用以JavaScript编写的子程序。

    <%@ language="javascript" %>
    <html>
    <head>
    <%
    function jsproc(num1,num2)
    {
    Response.Write(num1*num2)
    }
    %>
    </head>
    <body>
    <p>
    Result: <%jsproc(3,4)%>
    </p>
    </body>
    </html>

调用使用VBScript和JavaScript的子程序
    如何在一个ASP文件中调用以VBScript和JavaScript编写的子程序。

    <html>
    <head>
    <%
    sub vbproc(num1,num2)
    Response.Write(num1*num2)
    end sub
    %>
    <script  language="javascript" runat="server">
    function jsproc(num1,num2)
    {
    Response.Write(num1*num2)
    }
    </script>
    </head>
    <body>
    <p>Result: <%call vbproc(3,4)%></p>
    <p>Result: <%call jsproc(3,4)%></p>
    </body>
    </html>


相关文章


Copyright © 2004 - 2024 CNHWW Inc. All Rights Reserved
石家庄市征红网络科技有限公司版权所有 邮政编码:050051
服务电话:0311-85315152 13931185013 在线客服QQ:81447932 / 81447933 邮箱: cnhww@163.com