![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||||||||||||||
| |||||||||||||||
|
|
Therefore, I hope someone can answer a few questions about js files... 1. JavaScript on a web page has un-named routines, |
|
and named functions. |
|
Can we name those un-named routines and put them into a js file? |
|
If so, are they also defined as functions? Or do we use some other key word to define such routines? Can JS functions do everything that the un-named routines can do? |
|
That is, can we call the un-named routines a function even though we don't care what value they return? |
|
2. Is program flow an issue? |
|
That is, does html wait for a JS function to be called? |
|
3. Logically, we could have many functions in one js file, or one function in each of many js files. Other than ease of programming and use, why would I choose one approach rather than the other? |
|
4. Within an html page, variables in un-named routines appear to have page-level scope. |
|
So to define a page-level variable in a js file, do we just declare variables at the top of the page outside a routine, |
|
as in a VB module? |
|
5. Do js files stay in memory until the browser is closed? |
|
If so, that would imply that page-specific code should remain with the page, |
|
rather than be moved to a js file. Or is there a way to close a specific js module when an html page is closed? |
|
6. Can a routine in one js file call a function in another js file--assuming that both files are declared with <SCRIPT src="whatever">? |
#3
| ||||||
| ||||||
|
|
1. JavaScript on a web page has un-named routines, and named functions. Can we name those un-named routines and put them into a js file? If so, are they also defined as functions? Or do we use some other key word to define such routines? Can JS functions do everything that the un-named routines can do? That is, can we call the un-named routines a function even though we don't care what value they return? |
|
2. Is program flow an issue? That is, does html wait for a JS function to be called? |
If you have a function in the|
3. Logically, we could have many functions in one js file, or one function in each of many js files. Other than ease of programming and use, why would I choose one approach rather than the other? |
|
4. Within an html page, variables in un-named routines appear to have page-level scope. So to define a page-level variable in a js file, do we just declare variables at the top of the page outside a routine, as in a VB module? |
|
5. Do js files stay in memory until the browser is closed? If so, that would imply that page-specific code should remain with the page, rather than be moved to a js file. Or is there a way to close a specific js module when an html page is closed? |
|
6. Can a routine in one js file call a function in another js file--assuming that both files are declared with <SCRIPT src="whatever">? |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
I'm a newbie who needs advice about how to use external files of JavaScript code. |
#6
| |||
| |||
|
|
"Robert" <rccharles (AT) my-deja (DOT) com> wrote in message news:rccharles-696B9F.23193604042004 (AT) news2 (DOT) west.earthlink.net... In article <1071aa272tvck50 (AT) corp (DOT) supernews.com>, "Charley Kyd" <Kyd (AT) IncSight (DOT) com> wrote: I'm a newbie who needs advice about how to use external files of JavaScript Why would I ever want to maintain dozens of instances of the same code in dozens of web pages? I ***want*** to use an include file. Charley |
#7
| |||
| |||
|
#8
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |