grack.com

I added a style picker to the bottom of the page to allow the visitor to pick which style they would like to use when navigating the site.  It uses a piece of Javascript written by Mark Wilton-Jones to save the current stylesheet in a cookie and later restore it when the page changes.

Each style link consists of a short Javascript link like so:

javascript:changeStyle('Default Style')

A small script in the <head> section of the HTML, along with the body onunload method, is hooked up to the style saving/loading code to transparently maintain the user’s current style:

<script type="text/javascript" language="javascript1.2">
    useStyleAgain('lastStyle');
</script>

<body onload="useStyleAgain('lastStyle');" 
	onunload="rememberStyle('lastStyle');">

The Javascript to do this magic can be found here.

Read full post