Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 3rd, 2004, 03:51 PM
Authorized User
 
Join Date: Jan 2004
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default excluding html from printer ..

i know this is not the place for html .. but just asking ...

how do i exclude some html say a button from being printed ..

i cant use frames .. so what i want is exclude some text or graphics from printing with disrupting the way it is displayed on browser...

 
Old February 3rd, 2004, 04:09 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

If you know it's not the place for HTML, why do you post here? ;) There is a good HTML list a few clicks lower on the page....

You can use some CSS to hide the stuff you don't want to display when the page gets printed. Modern, standard compliant browsers support embedding a style sheet specifically for print media. Inside that style sheet, make sure the elements you don't want to be printed are hidden. Consider the following example that hides an HTML form button when the page is printed:
Code:
<html>
<head>
    <title>Non Printable STuff</title>
    <link href="/Styles/MainStyle.css" rel="stylesheet" type="text/css">
    <link href="/Styles/PrintStyle.css" rel="stylesheet" type="text/css" media="print">
</head>
<body>

<input type="button" value="I am hidden" style="NonPrintable">

</body>
</html>
As you can see, two stylesheets are linked in the head section. One for ordinary, on-screen style stuff. The other has been marked with media="print" which means it is only used when the page is printed.

To actually hide the button when the page is printed, you'll need to add the following definition for the NonPrintable class to the second stylesheet:
Code:
.NonPrintable
{
    display: none;
}
I usually use this trick in combination with a reversed, PrintOnly class that only outputs stuff when the page is printed (like the full address of the page, for example).

HtH,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Excluding certain records from a search RussLewis XSLT 5 March 4th, 2008 12:14 PM
Excluding Rows fs22 SQL Language 2 August 17th, 2005 12:58 PM
Printer.Printer Problem!! Pls Help Me Chamin Access VBA 0 December 10th, 2004 07:08 AM
excluding archives of a folder thomaz C# 4 March 8th, 2004 09:09 AM
Excluding items with certain keywords ashcarrot SQL Language 4 July 23rd, 2003 10:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.