[Javascript] How to call scripts that are all in one file...?

Jonathan Gold johnnyclock at gmail.com
Sat Feb 4 22:21:59 CST 2006


Yes, thanks Troy; they ran:  each routine or function was in its own
file (the 'javascripts' in the quoted code refers to a folder and then
after the slash the reference was to a file in that folder). But I
didn't want to have a separate file for each time I used javascript: 
I wanted to put them all in one file. Got bogged down for a while, but
I finally got it all straightened away with help from here.
My site is a  vanity site only, and the URL ought to show up at the
bottom of my sig. I am not a professional, but an interested amateur
or hobbyist. As I learn stuff, I throw it up on my site. Lately I'm
trying to be semantic and concise: got rid of frames and switched to
tables. Got rid of the tables and switched to CSS. Had lots of
javascripts at one time; got rid of most of them. With the great help
from this list I have re-learned some javascript and learned how to
refer to scripts in another file.

Thanks,

On 2/4/06, Troy III Ajnej <trojani2000 at hotmail.com> wrote:
> This is really confusing, your routine is good except for this:
> ><script type="text/javascript"
> >src="javascripts/myScripts.js/myFunction1()"></script>
> dit it actually run? Amazing!
>
> If your separate script files are wraped up in a function names{...the
> script instructions...} like this, they should not execute on load time,
> they should not execute at all, if not called by the script itself. But, if
> your script instructions are plain, they will execute while read
> preogressively.
> Make sure the scripts are separated by their function nature, after naming
> them and loading them (functions) fromt the script with your routine:
> ><script type="text/javascript" src="javascripts/myScripts.js"></script>,
> You have to either create another script from which you call the functions
> individually, or call them directly from the the page in conjunction with
> some event. But it all depends on what does each script do.
> Your 3 script files run separately with some delay between each other
> because of a download  delay, not because they are called in separate blocks
> of script tags.
> In order to give you a real answer, you have to explain what each script
> does and on what condition you like them to act and of course do they all
> have their unique function names (!not the script file names)?
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Troy III
> progressive art enterprise
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> >From: Jonathan Gold <johnnyclock at gmail.com>
> >Reply-To: "\[JavaScript List\]" <javascript at LaTech.edu>
> >To: "[JavaScript List]" <javascript at latech.edu>
> >Subject: Re: [Javascript] How to call scripts that are all in one file...?
> >Date: Fri, 3 Feb 2006 18:15:31 -0800
> >
> >I guess I wasn't clear; sorry. They are presently each in their own
> >file in a folder called 'javascripts' and I call them, now, like this:
> >
> ><script type="text/javascript" src="javascripts/myRoutine1.js"></script>
> >
> >And, then further down the html file, I call another:
> >
> ><script type="text/javascript" src="javascripts/myRoutine2.js"></script>
> >
> >And then, still further:
> >
> ><script type="text/javascript" src="javascripts/myFunction1.js"></script>
> >
> >What I would like to do is have them all be in _one_ file inside the
> >'javascripts' folder; say a file called 'myScripts.js'. When I try to
<snip>
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > Troy III
> > > progressive art enterprise

Jonathan
Berkeley, CA
http://home.pacbell.net/jonnygee/


More information about the Javascript mailing list