Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

table rows hidden in media print

0 views
Skip to first unread message

Martin Nadoll

unread,
Jun 25, 2004, 5:17:53 AM6/25/04
to
hello,

i have a php-file with all content in a table with a few rows and cols.
also i have some forms with all the buttons, and a bottom text-navigation.
there are no!! div-tags with absolute position.

i included 2 css-files, one for screen and one for print.

everything works fine so far, but on my print-page i see all the table-rows
with my submit-buttons and a table-row with my bottom-navigation.

nobody needs that on a print page.

is it possible, to remove this table-rows from my print page, to move the
following upwards?

it is not enough, to just hide those rows because it leaves me with a lot of
white-space.

Any ideas about that?

Thanks a lot,
Martin Nadoll


Stan Scott

unread,
Jun 25, 2004, 1:10:09 PM6/25/04
to
Martin,

Set up a screen/print style like this:

<style>
@MEDIA screen {
.screenOnly {display:block}
}

@MEDIA print {
.screenOnly {display:none}
}
</style>

For the rows you don't want to print, set each <td> to "screenOnly":

<td class="screenOnly">Text</td><td class="screenOnly">Text</td>

Be sure and set the table cellpadding attribute to 0, so there isn't a
small gap between the hidden rows.

Stan Scott
New York City


> is it possible, to remove this table-rows from my print page, to move the
> following upwards?
>
> it is not enough, to just hide those rows because it leaves me with a lot of
> white-space.

> Martin Nadoll

Stan Scott

unread,
Jul 2, 2004, 12:19:37 AM7/2/04
to
Martin,

Microsoft has two built-in methods, onBeforePrint and onAfterPrint.
Put the items you don't want to print into <SPAN> tags, giving each
one an id: ITEM1, ITEM2, etc. Then, put this onto your HTML page:

<script language="vbscript">
function document_onBeforePrint()
for t = 1 to 3 '(however many non-printing items you have)
document.getElementById("ITEM" & t).style.display = "none"
next
end function

function document_onAfterPrint()
for t = 1 to 3 '(however many non-printing items you have)
document.getElementById("ITEM" & t).style.display = "block"
next
end function
</script>

0 new messages