www.webdeveloper.com
Results 1 to 4 of 4

Thread: Functions / Procedures in ASP

  1. #1
    Join Date
    May 2005
    Posts
    230

    Functions / Procedures in ASP

    Is there any way to create functions and/or procedures in an ASP code? I am trying to do an iterative process that would call itself (nested) but I am currently unable to do even a most simple function (eg, js-style). Can anyone advise?

  2. #2
    Join Date
    Dec 2004
    Posts
    8,637
    Not sure exactly what you mean. The following is an example from one of my ASP pages where I am including a standard metadata library and several non-standard ASP functions that I wrote and share with several other pages:
    Code:
    <% @Language=VBScript %>
    <% Option Explicit %>
    <!-- METADATA TYPE="typelib" NAME="ADODB Type Library"
                  UUID="00000205-0000-0010-8000-00AA006D2EA4" -->
    <!-- #include virtual="/includes/GetAttributes.asp" -->
    <!-- #include virtual="/includes/GetMimeType.asp" -->
    <!-- #include virtual="/includes/mpRequestParser.asp" -->
    <%
    ...etc...
    ASP/VBScript functions are able to recurse and are structured as follows:
    Code:
    Function MyFunction(args)
        ...
        MyFunction = return_value
    End Function
    Also, if you're more comfortable with JavaScript, you can use JavaScript-type code as the scripting language in your ASP code, don't ya know? Just use the following header for your document and then code all ASP code as JavaScript-type (JScript) code.
    Code:
    <% @Language=JScript %>

  3. #3
    Join Date
    May 2005
    Posts
    230
    Thanks for the suggestion on JScript! I am a self learner and currently use MSSQL on database, VBScript on ASP and JavaScript on client-side. Merging ASP and client-side to the same coding style will certainly eliminate a few headaches, but I'm wondering if there is any compatibility or other issues I should consider when going to JScript instead of VBScript? Does JScript have equal acceptability?

  4. #4
    Join Date
    Dec 2004
    Posts
    8,637
    If your web host is using a Windows Server with IIS then, no, there are no issues between using ASP/JScript vs. ASP/VBScript. Microsoft provides support equally for both.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles