SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    a fresh, new start... dujmovicv's Avatar
    Join Date
    Aug 2006
    Location
    Earth
    Posts
    559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Print particular HTML tag

    Hi,
    I'm not sure if this is the right place for this thread so please moderators move it if needed...

    Is it possible to print a particular HTML tag (div or tr i.e.)?
    I have a link on a page in a <tr><td> tag

    HTML Code:
    <a href="Images/coupon_21.jpg" onclick="window.print()" target="_blank"><img src="Images/coupon_21.jpg" alt="" style="border:none"></a>
    now when a visitor clicks on the link, the printer will print the whole page. And I want it to print only this tag. I suppose there is a JS function to do that. Can someone give an advice?

    Thank you very much.
    Regards

    Full time ADMIN - art community
    Part time coder - dsign

  2. #2
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can hide everything on the page except this tag before calling window.print() and then show it after printing.
    I'm creating trouble-free Apache, PHP, MySQL installer, WITSuite,
    and use it to setup my development environment.
    Demo, support, contact. Questions?

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use a print style sheet to suppress the printing of everything else.
    Birnam wood is come to Dunsinane


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •