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
*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: memberh...@webstandardsgroup.org
*******************************************************************