Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: Embedded Files

  1. #1
    New to the CF scene
    Join Date
    May 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Embedded Files

    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:
    <header>
    <script language="JavaScript" src="Http://www.UselessFun.com/Script.js"></script>
    </header>

    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!

  • #2
    Regular Coder
    Join Date
    Feb 2003
    Posts
    638
    Thanks
    0
    Thanked 0 Times in 0 Posts
    - could have something to do with case

    have you tried:

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

  • #3
    New to the CF scene
    Join Date
    May 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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>.

  • #4
    New to the CF scene
    Join Date
    May 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    More About This Problem ...

    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?

  • #5
    Regular Coder
    Join Date
    Mar 2004
    Posts
    232
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #6
    New to the CF scene
    Join Date
    May 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •