Javascript cookies?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rjoseph
    New Member
    • Sep 2007
    • 36

    Javascript cookies?

    Hi Guys

    I think I have a really easy one for you.

    I am currently using the following script to store information in cookies:

    -------------SCRIPT--------------
    [CODE=asp]<%
    response.cookie s("prefs")("mak e")="Aston Martin"
    response.cookie s("prefs")("mod el")="Vanquis h"
    response.cookie s("prefs")("pri ce")="£40000"
    For Each cookie in Response.Cookie s
    Response.Cookie s(cookie).Expir es = now()+365
    Next
    %>
    [/CODE]-------------END-------------

    This works just fine in my ASP pages but now I need to incorporate the same method into some xml pages and therefore believe I need to use Javascript. I have spent hours reading numerous (how to set cookies in Javascript) articles and have not found a simple example that matches what I want to achieve above.

    Can anyone please put me out of my misery and provide me with a simple piece of code that I can use in my xml page to achieve the above?

    If so, then that would be great.

    I look forward to hearing from you

    Rod from the UK
    Last edited by acoder; Sep 27 '07, 05:54 PM. Reason: Added code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Please use code tags when posting code.

    What have you tried so far and what do you not understand?

    Note that the Javascript code would be in an HTML page as opposed to an XML page.

    Comment

    • rjoseph
      New Member
      • Sep 2007
      • 36

      #3
      Hi Acoder

      Thank your for your reply.

      I have been on this all day now and haven't got anywhere near doing what I want to achieve. I must of visited every possible website (including w3schools & irt.org) with articles devoted to Javascript cookies and none of them show examples of what I want to achieve. Instead they use what seems as over complicated scripting using <form> input in their examples. Everything is so much more simple in ASP! I have also asked this question to around 10 different message boards and no-one has come anywhere near to helping me out.

      I fully understand that people are not obliged to spoon feed me but if the experts can only suggest I read articles then I don't think I have a chance. Unless I get a sudden burst of inspiration I think I'm going to have to give this one up.

      Thanks anyway

      Rod from the UK

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Post your code so far (even if it doesn't contain anything about cookies) so we can work with that.

        Comment

        Working...