Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Style Sheet Switcher

  1. #1
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default Style Sheet Switcher

    1) CODE TITLE: Style Sheet Switcher

    2) AUTHOR NAME/NOTES: Michael Burt (http://mburt.funpic.org/)

    3) DESCRIPTION: A style sheet switcher which uses any element (select, radio, buttons, links). Similar to http://www.dynamicdrive.com/dynamici...etswitcher.htm, but much easier to implement. Examples and instructions on url below.

    4) URL TO CODE: http://mburt.mb.funpic.org/projects/css_switch/
    Last edited by mburt; 02-12-2007 at 09:07 PM.
    - Mike

  2. #2
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    If there's any problems, go ahead and say so!
    - Mike

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,030
    Thanks
    44
    Thanked 3,211 Times in 3,173 Posts
    Blog Entries
    12

    Default

    Pretty neat looking. I notice that you have two different stylesheets associated with the default option, depending upon where it appears in your markup. Other than that, all you need is perhaps a cookie to remember the choice for the page and/or the site.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Other than that, all you need is perhaps a cookie to remember the choice for the page and/or the site.
    That's a good idea... I'll try to implement that.
    - Mike

  5. #5
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Okay, the cookies are working well now too. Should I add a feature if the user wants the cookies enabled or not?
    - Mike

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    Nah. The user isn't all that smart about cookies generally.
    I think that using the cookie is nice.... if they want it, they want it.
    However, it's important to have an obvious 'reset'/'default' button if any of the layouts could potentially screw things up, such as white text on a white background or something, though that would be an unusual situation, probably.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #7
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Yeah... I tried that, but when you specify no "href" attribute it causes a bunch of errors. Kind of hard to deal with, but I'll think of something.
    - Mike

  8. #8
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    Hrm?

    <a href="anything.htm" onclick="return dostuff();">

    That's one way.

    Or...
    <a href="thispage.php?style=someserversidebackup" onClick="return dostuff();">
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  9. #9
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    I made an error catch now, so we don't need to worry about that Should be good to go.
    - Mike

  10. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,030
    Thanks
    44
    Thanked 3,211 Times in 3,173 Posts
    Blog Entries
    12

    Default

    Just something that was bothering me earlier after looking at the markup, and I just checked with the validator:

    Error Line 36 column 53: there is no attribute "SOURCE".
    <br><input type="button" class="change-style" source="green.css" value="Green">
    You could maybe use name rel or rev with links and value with checkboxes and radio buttons. For buttons, name - perhaps rel or rev might work.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •