Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > apply a print-only style

Reply
Thread Tools

apply a print-only style

 
 
Andrew Poulos
Guest
Posts: n/a
 
      07-10-2009
I can do something like

document.getElementById("btn").style.visibility = "hidden";

but is there a way to apply a style so that it only applies when the
page is being printed? I don't mean applying a style only while the page
is being printed and then removing the style when the page has finished
printing but, rather, the equivalent of

<style type="text/css" media="print">
#btn { visibility: hidden; }
</style>

Andrew Poulos
 
Reply With Quote
 
 
 
 
Andrew Poulos
Guest
Posts: n/a
 
      07-10-2009
Andrew Poulos wrote:
> I can do something like
>
> document.getElementById("btn").style.visibility = "hidden";
>
> but is there a way to apply a style so that it only applies when the
> page is being printed? I don't mean applying a style only while the page
> is being printed and then removing the style when the page has finished
> printing but, rather, the equivalent of
>
> <style type="text/css" media="print">
> #btn { visibility: hidden; }
> </style>


Its ok, I just discovered I can do

@media print {
#btn {
visibility: hidden:
}
}

in the style sheet. I'm not in a position to add to the head of the page
in question but I could edit the javascript or the CSS it referenced.

Andrew Poulos
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help to apply style to drop down list Hardy Wang ASP .Net 1 05-03-2005 04:03 PM
Need help with Style conversion from Style object to Style key/value collection. Ken Varn ASP .Net Building Controls 0 04-26-2004 07:06 PM
Apply style to a dynamic table in ASP.NET page Hardy Wang ASP .Net 2 04-14-2004 12:15 AM
how to apply css class style to web controls =?Utf-8?B?bnN2a2V5YW4=?= ASP .Net 1 02-20-2004 03:47 PM
[XSLT] could not apply "apply-templates" Stefan Siegl XML 1 07-18-2003 09:43 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57