RE: [WSG] Print stylesheet switcher

2006-01-18 Thread Ted Drake
Hi Joshua

I discussed something like this with Dunstin Diaz,
http://www.dustindiaz.com/?id=86paged=2,  of the AJAX style sheet switcher
fame. He suggested the print style sheets could be handled similarly.

For usability sake, I would suggest taking the visitor to a screen that
showed them what they are going to get when they print. It would suck to hit
print, then walk across the office, wait for the laser printer to get to
your page, only to find that it printed something you didn't want.

Perhaps the second button would popup a window with the information you want
to print and its own print style sheet.

Ted
www.tdrake.net

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Joshua Street
Sent: Tuesday, January 17, 2006 7:54 PM
To: wsg@webstandardsgroup.org
Subject: [WSG] Print stylesheet switcher

Hi all,

I've got a page that has a print stylesheet, and two elements of
important (i.e. the things you'd want to print) content. One is a list
of items, whilst the other element is a kind of More information
area (linked by XMLHttpRequest if JS is enabled).

In the More information bit, there's meant to be a print details
button. It was originally going to exist in an iframe, but I wasn't
too keen on that idea because it's generally disruptive in ways that
AJAX (or, in lieu of that, plain HTML with effectively-utilised
anchors) is not. So now I'm trying to print just the contents of that
DIV when a user clicks the print icon (using print(), or
window.print(), or whatever), but if the user attempts to print the
page normally -- that is, go File-Print -- the listing would print,
and the details of the currently selected item would not.

To achieve this I plan on using two stylesheets: the default print
stylesheet will discard the More Information div, whilst the More
Information div's print button will call (hopefully) a JavaScript
function that will set the print style to one in which the only item
displayed is that DIV (well, and a few other bits like H1, but it
doesn't matter: the point is it's another stylesheet), and THEN
print().

Normal JavaScript (media=screen) switchers are pretty common, but does
anyone have suggestions as to how best to go about this one?

n.b. I can't just switch the stylesheet when the More Information
field is loaded, because even when it is people may still want to
print the standard listing, which remains visible at all times. The
switching MUST apply just to the print styles, and MUST occur only
when the print 'button' is clicked (the button will be inserted into
the markup dynamically, so it remains clean for non-JS users).

Kind regards,

Josh Street
**
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list  getting help
**



**
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list  getting help
**



[WSG] Print stylesheet switcher

2006-01-17 Thread Joshua Street
Hi all,

I've got a page that has a print stylesheet, and two elements of
important (i.e. the things you'd want to print) content. One is a list
of items, whilst the other element is a kind of More information
area (linked by XMLHttpRequest if JS is enabled).

In the More information bit, there's meant to be a print details
button. It was originally going to exist in an iframe, but I wasn't
too keen on that idea because it's generally disruptive in ways that
AJAX (or, in lieu of that, plain HTML with effectively-utilised
anchors) is not. So now I'm trying to print just the contents of that
DIV when a user clicks the print icon (using print(), or
window.print(), or whatever), but if the user attempts to print the
page normally -- that is, go File-Print -- the listing would print,
and the details of the currently selected item would not.

To achieve this I plan on using two stylesheets: the default print
stylesheet will discard the More Information div, whilst the More
Information div's print button will call (hopefully) a JavaScript
function that will set the print style to one in which the only item
displayed is that DIV (well, and a few other bits like H1, but it
doesn't matter: the point is it's another stylesheet), and THEN
print().

Normal JavaScript (media=screen) switchers are pretty common, but does
anyone have suggestions as to how best to go about this one?

n.b. I can't just switch the stylesheet when the More Information
field is loaded, because even when it is people may still want to
print the standard listing, which remains visible at all times. The
switching MUST apply just to the print styles, and MUST occur only
when the print 'button' is clicked (the button will be inserted into
the markup dynamically, so it remains clean for non-JS users).

Kind regards,

Josh Street
**
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list  getting help
**