Alan & Kevin,
I believe the State of Virginia's requirement targets accessibility. A
server-side script would provide the most accessible solution.
If accessibility is not a consideration, a JavaScript style switcher
would suffice.
Cheers,
Nick Stone
Alan C. Whiteman wrote:
This sounds like a job for <button> and Javascript.
~~~~~~~~~~~~~~~~
Alan C. Whiteman
Visualis Web Design
http://visualis.us
(562) 305-2862
On Saturday 23 January 2010 16:02:39 you wrote:
*********************************************************************
WEB STANDARDS GROUP MAIL LIST DIGEST
*********************************************************************
From: "Erickson, Kevin (DOE)" <kevin.erick...@doe.virginia.gov>
Date: Fri, 22 Jan 2010 15:22:31 -0500
Subject: CSS off button
Hello fellow WSG'ers.
Could anyone please tell me if there is a right way to put a clickable
button in a web page that will turn off all CSS?
Thanks,
Kevin
*********************************************************************
From: Paul Novitski <p...@juniperwebcraft.com>
Date: Fri, 22 Jan 2010 13:44:30 -0800
Subject: Re: [WSG] CSS off button
At 1/22/2010 12:22 PM, Erickson, Kevin (DOE) wrote:
Could anyone please tell me if there is a right way to put a
clickable button in a web page that will turn off all CSS?
To be perhaps overly precise, I'm guessing that you probably don't
want to turn off *all* styling because that would render your
document as one long string of undifferentiated text, but instead you
want to keep the browser's default styling and/or the user's custom
styling and suppress the page author's additional styling.
The approach would most likely be to strip out the style elements
from the html head and the style attributes from all elements on the
page. I think it would be unreasonable to ask a program to also
suppress styling imposed by client-side scripting but if you were
being paid enough this would be doable.
The best practice way to do this would be, first of all, to provide a
submit button or link that asked a server-side script to re-deliver
the current page with style elements and attributes removed. Then you
could add a JavaScript layer that intercepted the button click and
stripped away styling on the fly. I don't think removing the style
elements in the head after a page is rendered has the desired effect,
so you'd probably have to delete all the children of the style object
in addition to deleting the style attributes on the page.
Depending on your purpose, you'd also want to decide whether to strip
other presentational elements and attributes at the same time.
Regards,
Paul
__________________________
Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com
*********************************************************************
From: Nick Stone <boa...@nick-stone.com>
Date: Fri, 22 Jan 2010 16:51:19 -0500
Subject: Re: [WSG] CSS off button
Kevin,
I believe you could do it with PHP by having your "Off" button reload
the page, replacing your default header with one that omits your CSS
file(s). You could use a cookie to make the other pages also load
without CSS until the switch is toggled again.
*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: memberh...@webstandardsgroup.org
*******************************************************************