I have my index.html at the root of my web host, and my javascript file is in a directory(JavaScript) which is also at the root. How can I link my index to the js file? I did the following, but it's not working: <script type="text/javascript" src="JavaScript/filename.js"></script>
in the head. It works when I do the inline javascript
views:
22answers:
1
A:
<script type="text/javascript" src="JavaScript/file.js"></script>
Loads the file.js in the subdirectory "JavaScript". It'll work unless a base href is specified.
Edit: I see now that's pretty much what you had. Should work. You got full code or URL?
Alexander Sagen
2010-09-27 05:01:27
<head><script type="text/javascript" src="JavaScript/ScrollingMessage.js"></script><link rel="stylesheet" type="text/css" href="/CSS/style.css" /></head><body><center><h1>The Website is under construction</h1> <form name="msgForm" action="" > <input type="text" name="scrollingMsg" size="25"/> </form></body>
2010-09-27 05:16:11
It doesn't work for css either. It works only when all the files are at the root
2010-09-27 05:18:59
here is my site: www.phathoang.info
2010-09-27 05:19:58
So the server is responding that there's no such thing as http://www.phathoang.info/JavaScript/ScrollingMessage.js. You're sure it's in that folder and actually under the web root, not your home directory or whatever? If so, I would guess some server misconfiguration.
Alexander Sagen
2010-09-27 05:28:43
It's just working now, have no idea what happened. thanks for ur concern!
2010-09-27 05:53:41