#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Posts
    162
    Rep Power
    11

    select and remember css


    Is it possible to have 3 buttons, images, or links which change to a different stylesheet at runtime?

    E.g. link1 for style1.css, link2 for style2.css etc

    Once the stylesheet has been selected by the user, how do you get it to remember the selected stylesheet, so the nexttime the user visits, the last selected stylesheet is loaded?

    im guessing i will have to use sessions or cookies, but how?

    can anyone help out?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2004
    Location
    Hong Kong
    Posts
    99
    Rep Power
    11
    To remember the last used style sheet, you can store them in the cookie via the Response object:
    // C# code
    Response.Cookies.Add(new HttpCookie("A_NAME", "A_Value_To_Be_Stored"));

    However, this may not work if the web client has cookie disabled. So a better way of doing it is to store the value in the server side, say in a database or simple a plain text file.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Posts
    162
    Rep Power
    11
    Thanks

IMN logo majestic logo threadwatch logo seochat tools logo