2 replies [Last post]
Alex Taylor
Offline
newbie
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.

janim
Offline
Regular
phinland
Last seen: 17 years 39 weeks ago
phinland
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
else
    // use the normal style css file

dJomp
dJomp's picture
Offline
Enthusiast
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.