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!

Javascrip[t linking in HTML

Status
Not open for further replies.
Jun 26, 2003
29
0
0
US
Hello all,
I'm working on a website and want to link some JS into my pages so i don't have to type out the script 10,000 times. I know the whole <link rel=&quot;javascript&quot; type=&quot;text/javascript&quot; href=&quot;filename.js&quot;> dealie. My question is how do I set where this will appear on the page. At one point in the past i could do this, but only in the same directory (i.e. I couldn't do it for a file that was in js/filename.js, just one that was in the same directory as the HTML document. Any help is greatly appreated!
~Shane
 
Well I'm not sure if this is still supported or not as I haven't done any real JavaScript since version 1.2

Anyways it used to be:
Code:
<script src=&quot;myscript.js&quot;>
</script>

which you could put in the body or the head, but I assume what you mentioned is like an include thus inserting the code wherever you put the <link rel ..... >
 
<div>Above</div>

<script src=&quot;javascript.js&quot;></script>

<div>Below</div>

That's how I do it.

----------
I'm willing to trade custom scripts for... [see profile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top