View Full Version : Embedded Files

05-08-2004, 01:34 AM
I do have programming knowledge, however I have never worked with Javascript before. I have a script that rotates ads on my website. The problem is this: I want to have the source as an external file so that I don't have to update every single page of my site each time I change something. Well, I looked around and found that I can use the SRC attribute to do this. When I insert this into my page it works fine:
<script language="JavaScript" src="Http://www.UselessFun.com/Script.js"></script>

BUT when I upload to my server, it no longer works. So it works locally, but not when I upload to my host. Are there any suggestions from someone who knows more about javascript than I do? Thanks a lot!

05-08-2004, 02:40 AM
- could have something to do with case ;)

have you tried:

<script language="JavaScript" src="http://www.uselessfun.com/Script.js"></script>

05-08-2004, 04:59 PM
Yes -- when I just put it under the <head> tag it doesn't work at all, but when I put it under <header> it does, which is why it's in my <head> section under <header>. :confused:

05-08-2004, 05:15 PM
I've noticed something else as I've been working with this ...

The script doesn't work when I call it from my server (Http://www.Uselessfun.com/Script.js), but it works when I call the file out of my local directory (Script.js). So it seems that the problem has something do with the file at the server itself. What happens is it comes up with an error, saying a variable is undefined. But I know the script works just fine. Any suggestions?

05-08-2004, 06:15 PM
I got one, some servers dont allow linking (like for images) from other sites, it probably does this by if it is not called in a local directory it does not give the file out, e.g. try putting an image on the server and linking to it from a http:// directory (not a local one) that could be the problem :thumbsup:

05-08-2004, 09:03 PM
I saved all the images and linked to them locally and that didn't solve the problem. I can take the script that's in my file and place it into the head of my document and it will work fine, even though it's calling images from another server.

Thank you for the suggestion, though -- the server supplying the ad images was a bit unstable, and 1/4 of the time no ad appeared at all. Now, with the images saved on my server, I know the ads will appear!