Including Javascript files from script

  • Thread starter Christopher Benson-Manica
  • Start date
C

Christopher Benson-Manica

I'm betting that this is impossible, but I'm wondering if a script can
by some mechanism "include" another script source file, perhaps in a
manner analagous to C's #include directive. One (probably bad) idea
that came to mind is writing appropriate <script> tags to the document
as needed. Is that the only option?
 
M

Michael Winter

[Can a script] "include" another script source file, perhaps in a
manner analagous to C's #include directive. [...]

Search this archives. This has been covered before.

Mike
 
K

kaeli

I'm betting that this is impossible, but I'm wondering if a script can
by some mechanism "include" another script source file, perhaps in a
manner analagous to C's #include directive. One (probably bad) idea
that came to mind is writing appropriate <script> tags to the document
as needed. Is that the only option?


See this example for an alternative. DOM browsers only.
http://www.ipwebdesign.net/kaelisSpace/useful_serverClientValidation.html

--
--
~kaeli~
Synonym: the word you use in place of a word you can't
spell.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated Mon, 2 May 2005
14:21:25, seen in Christopher Benson-Manica
I'm betting that this is impossible, but I'm wondering if a script can
by some mechanism "include" another script source file, perhaps in a
manner analagous to C's #include directive. One (probably bad) idea
that came to mind is writing appropriate <script> tags to the document
as needed. Is that the only option?

"analogous".

document.write('<script type="text/javascript" src="include2.js"></script>')
document.write(TestCounter)

The value of TestCounter set in local file include2.js was written.

On the Web, it will probably be necessary to wait until the file has been
read (???).

Try <URL:http://www.merlyn.demon.co.uk/js-nclds.htm>.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top