Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print everything except these two images 2

Status
Not open for further replies.

JeroenB

Programmer
Apr 8, 2001
93
BE
Hi,

I've made a print button on my html page;
but the prob is now that when pressing it, I want indeed to print everything except 2 gif's which are also in the same frame of the page.

Does anyone knows how I can solve this ? Is there any script I can place within these 2 pictures ?

Thanks in advance,
JeroenB
 
there is a simple solution in IE5+/moz(i think):

<style media=&quot;screen&quot;>
img {}
</style>
<style media=&quot;print&quot;>
img {display:none;}
</style>

as far as NS4 goes, you may be able to hide them when your press the button. something like:

document.layerimageisin.visibility='hide' jared@eae.net -
 
I don't know if NS has them or not, but you can use an onbeforeprint function to hide thing you don't want printed, and an onafterprint function to reshow them. Assign things you don't want printed a class of &quot;nonprint&quot; and you can use this:
Code:
function window.onbeforeprint() {
   var coll = document.all.tags(&quot;input&quot;);
   if ( coll != null ) {
      for (i=0; i<coll.length ; i++) {
         if ( coll[i].className = &quot;nonprint&quot; ) {
            coll[i].style.display = &quot;none&quot;;
         }
      }
   }
}
function window.onafterprint() {
   var coll = document.all.tags(&quot;input&quot;);
   if ( coll != null ) {
      for (i=0; i<coll.length ; i++) {
         if ( coll[i].className = &quot;nonprint&quot; ) {
            coll[i].style.display = &quot;inline&quot;;
         }
      }
   }
}
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top