Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to include js file?

Status
Not open for further replies.

111101101

Programmer
Oct 16, 2003
39
0
0
US
Okay, i already have a javascrip file. I now have another javascript file, but inside the code contains

<script language=&quot;Javascript&quot;>
js codes.....
</script>

you see. the <> tags are NOT javascript, but the file is named something.js so is it a javascript file or should it be html file?

Now i want to include that file into ALL my pages... how do i do that? using SSI? I have already in ALL my pages somethign liek this....

<script language=&quot;Javascript&quot; src=&quot;lib_functions.js&quot;>
</script>

so how do i add my javascript code that i want that resides in something.js into all my pages? remember, the something.js code has javascript code AND html code,

how to do this?
 
Let me clarify.... i guess what i am trying to do is
have my Javascript file include HTML source file. How do i do that?

Traditionally, it has always been the html file include javascript file but i want to do it the other way around.

So how do i include HTML file in javascript file?

Thanks.
755
 
do NOT include the <script> tags inside a .js file - only javascript code.

if you want to output HTML from a .js file, you would do something like this:

document.write('<h1 align=&quot;center&quot;>hello from javascript</h1>');

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top