Results 1 to 3 of 3

Thread: Javascript stylesheet swap based on cookie

  1. #1
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Javascript stylesheet swap based on cookie

    ok here's my issue.

    i have a login page which remembers the inputted password in a cookie. once the login is successful, i need to dynamically load one of 2 stylesheets based on the password value in the cookie.

    this is for a demo so i only need it to change between 2 stylesheets and i'm only using 2 possible passwords. seems like it's not that hard but my brain is fried. please help!!!

    Kristiandavid

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Got a link and or code?

  3. #3
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    this makes the cookie :
    function set_cookiePass(c_pass, form){
    document.cookie=c_pass+"="+form.Password.value;
    }


    this is the sumbit button;
    <input name="Submit" type="submit" value="Submit" onclick="set_cookiePass('password',this.form);MM_goToURL('parent','http://66.11.64.70/csp2/main2.html');return document.MM_returnValue" />

    those work fine, now i just need to grab the cookie on the following page and based on the password value, change the stylesheet.

    ie : if user enters 'pass1' as the password, the following page will load 'style1.css'
    if user enters 'pass2' as the password, the following page will load 'style2.css'

Bookmarks

Posting Permissions

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