|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Storing commonly used function/variables/scripts
I'm currently building my site using ASP and javascript. I found i have a few functions and variables and some javascripts that are required on every pages in my site.
I was wondering if i can store all these commonly used functions/variable/scripts in one location, so i can cut down my codes and for easy maintenence too. Other than the global.asa file which is used to store global variable, so i create another global file? Please advise. Thanks! |
|
#2
|
|||
|
|||
|
other than global.asa, you can store it as include file's.
put this code in every page that needs the commonly used scripts. Code:
<!--#include file="scripts.asp"--> And in this scripts.asp, you store all your functions/scripts.
__________________
Hope this helps. Mike Royal Selangor Pewter "I have not failed. I've just found 10,000 ways that won't work." - Thomas Alva Edison (1847-1931) |
|
#3
|
|||
|
|||
|
after adding the "include file" do i call the function as if they were stored locally on the same page?
|
|
#4
|
|||
|
|||
|
yes.
|
|
#5
|
|||
|
|||
|
declaring variables and functions and including them in each page will affect run time performance since includes are executed no matter what.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Storing commonly used function/variables/scripts |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|