2 replies [Last post]
Alex Taylor
Vancouver, BC Canada
Last seen: 17 years 41 weeks ago
Vancouver, BC Canada
Timezone: GMT-8
Joined: 2004-04-13
Posts: 7
Points: 0

I'm developing a site for a client, and one of the pages is a lengthy legal contract. I have an option to view a printable version of the site if they want to print it out.

I already have specified an alternate stylesheet on each page for print media, but I want something that the user can select through a link and quickly switch the stylesheet. Is there an elegant way to do this? I've tried the ALA javascript but I'm convinced there has to be a simpler way. If anybody has any tips it would be much appreciated.

Last seen: 17 years 39 weeks ago
Joined: 2004-04-26
Posts: 11
Points: 0

One-time style switching with a link

It's simple if you're using server-side scripting.
For example with php, you could create a link "page.php?layout=print"
and in the page.php file:

if ($_GET["layout"] == "print")
    // use the print style css file
    // use the normal style css file

dJomp's picture
Last seen: 5 years 51 weeks ago
Joined: 2003-03-23
Posts: 422
Points: 0

One-time style switching with a link

If your pages aren't PHP however, javascript is the easiest way to go about things.

You know you're a geek when you try to shoo a fly away from the monitor with your cursor.