I have read the following message from " JCO" <J.********@verizon.net>
and have decided to lend my vast knowledge.
The writer said:
I have several JavaScripts in a web page. Each script is in an individual
file with extension .js.
I want to know if it is possible to put all functions in one single page.
If so, how do I call the specific script that I want to run.
This is how I call an individual script:
<SCRIPT LANGUAGE="JavaScript" src="valForm.js"></SCRIPT>
Where valForm is a script that looks like this:
function valForm()
{
if( document.frmPassword.txtInput.value == "password" )
document.location.href="Private.htm";
else
document.location.href="NoAccessPage.htm";
}
If a single script contains 5-10 functions, how do you call the specific
function you want?
Thanks in advance.
and my reply is:
The name of a js file has nothing to do with the name of the function
inside. In fact a script may not even contain a function. You can one
or multiple js files depending on how you use them. The browser loads
them all into the page and does't care where they came from. Just name
them anything you want.
function xxx() {
....
};
function yyy() {
....
};
function zzz() {
....
};
Put the above in 1, 2, or 3 js files. It doesn't matter.
To use a function just refer to it's name
xxx() or yyy() or zzz()
--
Dennis M. Marks
http://www.dcs-chico.com/~denmarks/
Replace domain.invalid with dcsi.net
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----