On Fri, Sep 01, 2006 at 06:35:37PM +0100, Designer wrote:
> I have a one year calendar, where each day is a table cell. I have CSS 
> and php controlling the visual presentation of it.   If a day is 
> 'booked' it is assigned to be an event and shows up via a CSS class thus:

No such thing as a CSS class. HTML has classes, CSS has selectors
which can match HTML classes.

> .event {

> in other words, the day appears as a grey block.  That's fine, but I 
> want to be able to print out the calendar, and (of course) if the user 
> has background printing turned off, nothing appears apart from the text. 
> 
> My question, then, is can one check to see (DOM?) if the background is 
> #666; and if so, can the content be changed to 'n/a' (or something) in 
> the printout, 

Well, you could do something like:

var cells = document.getElementsByTagName('td');
for (var i = 0; i < cells.length; i++) {
  if (cells[i].className != 'event') {
    var text = "n/a";
    var textNode = document.createTextNode(text);
    var span = document.createElement('span');
    span.className = 'printOnly';
    span.appendChild(textNode);
    cells[i].appendChild(span);
  }
}

but ...

> so all users get a meaningful print?

Why isn't the lack of text content of the cells meaningful already? Or
is the sole indication that something is happening on a day the
stylesheet?  (Hint optional presentation layers are not the ideal
place to put content).

-- 
David Dorward                                      http://dorward.me.uk



*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to