#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    11
    Rep Power
    0

    Reloading page with different CSS


    Is it possible, through a link on a page, to reload that page with a different CSS, that is, different page definitions?
    I'd like to have a page with 5 or so different buttons, links, etc, which will demonstrate different layouts of that page.
    Interesting, eh?
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    11
    Rep Power
    0
    Why doesn't this work?



    <?php
    if ($csstype == "style_1")
    {
    <link href="style_1.css" rel="stylesheet" type="text/css">
    }
    elseif ($csstype == "style_2")
    {
    <link href="style_2.css" rel="stylesheet" type="text/css">
    }
    else
    {
    <link href="style_1.css" rel="stylesheet" type="text/css">
    }
    ?>
    Last edited by bruce66; September 16th, 2003 at 11:49 PM.
  4. #3
  5. No Profile Picture
    Super Moderator
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,009
    Rep Power
    2791
    So many issues with that code, I won't even start.

    You really should be asking this question in the PHP forum. Even though it has to do with stylesheets, it is a dynamic issue.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    173
    Rep Power
    12
    building off of the 2nd post, and using javscript there are so many ways to do this.

    one:
    Use innerHTML to rewrite the link element using a diff stylesheet.

    two:
    using query strings and if statements to check what stylesheet should be used.

    three:
    I think you can use css to define alternate stylesheets, but I stopped reading on that subject.. looked like to much work for me.. and I'm too lazy
    We all have souls.... where do you want your to go?

    The little princess
    Back from the dead
    The only Hope / End Times
  8. #5
  9. No Profile Picture
    Super Moderator
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,009
    Rep Power
    2791
    You can easily change the stylesheet with CSS or JS, but I assumed that you would want the user to be able to retain their choice. A mix of JS and cookies could perform this, but I would use one of the server-side languages personally.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    152
    Rep Power
    12
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2002
    Location
    Canberra, Australia
    Posts
    348
    Rep Power
    13
    for some working examples of the above post check out

    http://www.101webtech.com

    http://www.centrelink.gov.au/interne...102/change.htm

    These rely on alternate stylesheets and cookies...

    my CSS hero's site Eric Meyer

    http://www.meyerweb.com/

    Check out the presentation links and the advanced setup


    good luck

IMN logo majestic logo threadwatch logo seochat tools logo