[Javascript] Link Style Pages

Edwin Martin edwin at bitstorm.org
Fri Feb 23 07:14:56 CST 2007


Del Wegener schreef:
> However, the only way I know how to implement this is to have two 
> different
> links to two different pages whose only difference is that single line in
> the header of the page.
>
> Is there any way I can have a single page and vary the linked style sheet
> depending on which hyperlink I click on?  Is there a JavaScript 
> solution to my problem?
Yes. You can create a main style sheet and several alternative 
stylesheets. Give the stylesheets a title.

Then you can (at least in Firefox) select the stylesheet you want in the 
View -> Style menu.

Example code:

<link title="Main" rel="stylesheet" type="text/css" href="home.css" media="screen, print, projection"/>
<link title="Minimal" rel="alternate stylesheet" type="text/css" href="minimal.css" media="all"/>

Edwin Martin

-- 
http://www.bitstorm.org/edwin/en/





More information about the Javascript mailing list