Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can you create a asp function in a separate file ?

ASP 101

how can you create a asp function in a separate file ?

by  ani4  Posted    (Edited  )
Firstly you need to create a dedicated asp file, which contain the code of the function :

----------------------myFunction.asp-----------------------
<%function square_calc(args)

args=args*args

square_calc = args 'return the value of args
%>
----------------------------------------------------------

In the asp pages(example.asp) where you call the function you just need to include it and you can call simply the function

-----------------------example.asp------------------------
<!-- #INCLUDE FILE="MyFunction.asp" -->

<HTML>
<HEAD><TITLE> An example of a function calling </TITLE> </HEAD>
<BODY>

the square of 3 is <%response.write square_calc(3)%>

</BODY></HTML>

-----------------------------------------------------------


It s done, you can add now different function in the Myfunction.asp page and call it as you want.

Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top