BleepingComputer.com: Alternating Style Sheets

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Alternating Style Sheets Can alternate style sheets be changed out programmatically?

#1 User is offline   Ray Parrish 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 91
  • Joined: 30-October 08
  • Gender:Male
  • Location:Cottage Grove, Oregon

Posted 13 November 2008 - 06:31 PM

Hello,

While reading in the W3C pages I discovered that one can create and link several differing style sheets which can be used as alternate style sheets.

I did so, and in Firefox I am given the opportunity to change which style to use on the View, Page Styles menu. However, my selection only sticks for the page I'm on, if I load another page it is in the default style again, and if I go back to the first page it is once again in the default style, the settings don't stick.

Also, I am told by a friend of mine who uses Internet Explorer that the the second [last] style sheet specified is loaded as the default style, and she was not presented with any mechanism to change styles within IE. Why doesn't IE load the default [first] style sheet as per the W3C?

So, what I'd like to do ideally is create a script in javascript which will interact with a button or a drop down list that allows users of my web site to change between styles.

Is it possible to specify which style sheet to use with javascript and make it stick across all the pages?

Later, Ray Parrish

#2 User is offline   Ray Parrish 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 91
  • Joined: 30-October 08
  • Gender:Male
  • Location:Cottage Grove, Oregon

Posted 13 November 2008 - 06:58 PM

LOL! Well, I should have done a little more reading first! I found an example on W3C that show how to change style sheets with a button and javascript, so now I think I can write a change style function.

Now...how to make the selection stick as the user changes pages? Do I need to write a cookie for this?

Later, Ray Parrish

#3 User is offline   groovicus 

  • Hail Groovicus!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 9,605
  • Joined: 05-June 04
  • Gender:Male
  • Location:Centerville, SD

Posted 13 November 2008 - 07:07 PM

Cookies are the only way that I can think of to do it, unless the user's preferences are kept in a database and correlated with a unique user id.
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens

#4 User is offline   Ray Parrish 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 91
  • Joined: 30-October 08
  • Gender:Male
  • Location:Cottage Grove, Oregon

Posted 13 November 2008 - 08:22 PM

Thanks again, I'm reading up on cookies now at the W3C, it's a great reference!

Later, Ray Parrish

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users