Click to See Complete Forum and Search --> : Including .js files in html page
stargazer478
01-19-2003, 11:49 PM
I was wondering if there was any disadvantage to using the statement <script language="javascript" src="main.js"></script> as opposed to just writing the javascript inside the HTML page. I wanted to use a generic javascript file because I reuse the same html code to create the headers/footers and basic page content. Should I also include <noscript> with the actual html code incase someone has javascript turned off?
Thx for any help.
ShrineDesigns
01-19-2003, 11:59 PM
there is no disadvantage for using an external JavaScript, although if all you want to do with it is generate portions of a HTML document, try this, if your server supports it, you wont have to worry about browsers that don't support JavaScript
<!-- include virtual="header.txt" -->
stargazer478
01-20-2003, 12:01 AM
I never saw that tag before. Where does it go?
Would I still need to use the noscript tag incase javascript is turned off?
Originally posted by ShrineDesigns
<!-- include virtual="header.txt" -->That should be <!--#include virtual="header.txt"-->
Also, it is a Server Side Include tag. It goes exactly where you want the content of header.txt to appear. Also, you won't need to specify <noscript> unless header.txt contains JavaScript. You will need to rename you pages to either .shtml or .shtm for this to work, and have a server that supports SSI.