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
  1. #1
    New Coder
    Join Date
    Aug 2003
    Location
    Liverpool
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript/Cookie help needed *URGENT*

    I need some help for University cousework that has been sent and I hope someone here can help.

    I need to create a cookie (easy enough) and then populate that cookie with a word that is selected when you click a certain image.

    Imagine you have image1.jpg and image2.jpg when a user selects image1.jpg the cookie needs to store image1 and load page2.html

    If the user selects image2, then page2.html still needs to load but store the word image2 in the cookie.

    On the next page, the cookie is loaded and the page needs to load the css file associated with that word

    example:
    image1 = firstcss.css
    image2 = secondcss.css

    Is this possible?

    Thank you for all your help

  • #2
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Quote Originally Posted by NYCSavage View Post

    Is this possible?
    Do you think somebody took the trouble to formulate that assignment without knowing that it could actually be done?
    How far have you got and where are you stuck?

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,910
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Please see Forum Rule 1.5. We will not do your coursework for you, but you are welcome to for assistance with specific Javascript problems.

  • #4
    New Coder
    Join Date
    Aug 2003
    Location
    Liverpool
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Logic Ali View Post
    Do you think somebody took the trouble to formulate that assignment without knowing that it could actually be done?
    How far have you got and where are you stuck?
    The assignment is to create a website that loads an external XML page and manipulates the data and then design the results with CSS. I wanted to go the extra step by adding a cookie that allows the user to change the CSS and for the changed CSS to work on every page.

    I can create the cookie, but I don't know how to populate it by clicking on an image.

    On the next page I can then find the cookie and read from it but don't know how to make it affect the CSS style chosen. I can use Javascript to change the CSS but don't know how to link the two of them.

    Quote Originally Posted by Philip M View Post
    Please see Forum Rule 1.5. We will not do your coursework for you, but you are welcome to for assistance with specific Javascript problems.
    I understand this, and haven't asked for a complete solution, just an idea how to reach my goals. This isn't part of my coursework, it is just me going for extra points.

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,155
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    http://www.alistapart.com/articles/alternate/

    More than you asked for. Probably more than you wanted to know.

    p.s.: I found it by doing this:
    http://www.lmgtfy.com/?q=specify+act...via+javascript
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #6
    New Coder
    Join Date
    Aug 2003
    Location
    Liverpool
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    http://www.alistapart.com/articles/alternate/

    More than you asked for. Probably more than you wanted to know.
    That is amazing! Has everything I need.

    Thank you so much, this should boost my percentage up a fair bit

    ps: I did use Google but didnt know it was called active css

    I did try searching or results like:
    How to change CSS using javascript
    and
    How to change CSS using a cookie
    lol


  •  

    Tags for this Thread

    Posting Permissions

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