Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Print in Javascript

    I want to print a perticular portion of the page
    i mean only a table from the whole page how can i??

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    just use CSS print styles to hide the portions of the page you don't want printed. there's no need for JS at all.
    *keep it simple (TM)

  • #3
    Regular Coder
    Join Date
    Nov 2003
    Location
    Vancouver Island Canada
    Posts
    139
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <html><head>
    <style media="print">
    .noPrint {display:none;}
    </style>
    </head>
    <body>
    <p> will print this</p>
    <p class = "noPrint"> won't print this or anything else with this class</p>
    <a href = "#" class = "noPrint" onclick = "javascipt:print()">Print this</a>
    </body>
    </html>
    Hope this helps
    Last edited by glenmac; 02-03-2005 at 01:05 PM.


  •  

    Posting Permissions

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