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 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript working on local but not working when uploaded to host.

    I hope I have this post in the right place! Any help would be very much appreciated...

    I have a feature on my website that allows users to choose the website background (using alternate css sheets) and then uses an externally linked javascript file to store the background choice as a cookie so it is consistent throughout the website.

    This works perfectly locally (i.e. when previewing my website on my computer) but now it is uploaded to my host it doesn't appear to be working. (with the same browser)

    My javascript is here:
    http://www. b r p - e n v .com/javascript/backgroundchange.js (with no spaces)

    The website that the javascript file is linked to is http://www. b r p - e n v .com (with no spaces)

    In the head I have:
    <script type="text/javascript" src="../javascript/backgroundchange.js"></script>

    ...then I have: <body onload="set_style_from_cookie()">

    ...and for users to choose which background:
    <form>
    <input type="image" src="../images/white-background-thumb.jpg"
    onclick="switch_style('bg1');return false;"
    name="theme" value="White" id="bg1">
    etc...
    </form>

    My problem is: The background reverts back to the default when moving to a different page. This would indicate that the background choice is not being saved in cookies. But this works locally!

    I have tried putting the javascript directly onto each page but I still had the same problem.

    I hope someone can help, I will be so grateful if I can get this to work.

    Many thanks indeed!
    Last edited by mike21bass; 08-25-2010 at 01:42 PM.


 

Posting Permissions

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