Welcome to the OzoneAsylum FaqWiki
Frequently Asked Questions

How do I change stylesheets dynamically? Pages that link to <a href="https://ozoneasylum.com/backlink?for=4833" title="Pages that link to How do I change stylesheets dynamically?" rel="nofollow" >How do I change stylesheets dynamically?\

There a number of ways of doing it and we touch on a number of the answers here:

Changing styles "on the fly"

One simple way is to use this:

<script language="Javascript" type="text/javascript">
function setStyle (stylename) {
var lnk = document.getElementsByTagName("LINK")&amp;#91;0&amp;#93;;
lnk.href = stylename;}

Doc Ozone has worked another one of these techniques up into an excellent example at Znippets here:

ZScrollBar demo

Another way is used in this article at AListApart:

style sheet switcher

Relevant threads:

Changing styles "on the fly"

Default CSS

Relevant note:

As of the time of writing this FAQ was number 1 in searches at google for the terms change, stylesheets.


(Added by: Emperor on Sun 19-May-2002)

(Edited by: Emperor on Wed 30-Jul-2003)

« BackwardsOnwards »

Show Forum Drop Down Menu