Forum Moderators: open
I tried <script type="text/javascript" language="javascript" src="src="coolmenu.js"></script>
But it doesn't work. My index page is index.shtml and I have a php include working
Thanks,
<script language="JavaScript" src="http://www.mydomain.co.uk/myfile.js"></script>
<script language="JavaScript" src="myfile.js"></script>
the actual file does not have the script language="JavaScript"head and foot, but rather goes straight into the scripting code.
<script language="JavaScript" src="coolmenu.js"></script>
I have never put the type in the script tag like you had, and I always capitalize the J and S in JavaScript. It would be wierd if that were your problem, but who knows? Also, make sure that the coolmenu.js file is in the same directory as the file generating your html. It may be a path problem.
Essentially, the line that calls your include.js is calling your .js contents as Javascript code. So your include.js needs to use Javascript only to output your content.
What Sinner_G said - use document.write. :)
Just curious - how come you want to use Javascript includes if you've got PHP happening? IMO, server side is heaps better!
[edited by: jatar_k at 1:38 pm (utc) on April 16, 2008]