Results 1 to 4 of 4

Thread: Print a Section of the page using <div id="p1234">

  1. #1
    Join Date
    Sep 2004
    Location
    Little Falls, Roodepoort, South Africa
    Posts
    406
    Thanks
    4
    Thanked 1 Time in 1 Post

    Exclamation Print a Section of the page using <div id="p1234">

    Hi

    Can someone help me with my code, I'm tryig to print sections of a website on user request, i.e the website http://www.silvertreeestates.co.za/ has many property listings, and I want to put a print button at the bottom of each listing to allow the user to be able to print that section only.

    I did create a jsfiddle https://jsfiddle.net/SimonRWFish/3e462gqa/5/

    Code I'm trying to use is
    Code:
    <script>
    function printDiv(divName) {
          var printContents = document.getElementById(divName).innerHTML;    
       var originalContents = document.body.innerHTML;      
       document.body.innerHTML = printContents;     
       window.print();     
       document.body.innerHTML = originalContents;
       }
    </script>
    I also want to bring my style sheet though into the popup window and a logo is possible

    Style sheet is http://www.silvertreeestates.co.za/a...s/stestyle.css

    Logo would be "smlogosprite"

    Any help , advice is appreciated as always....
    Last edited by simonf; 07-10-2017 at 12:19 PM.
    Very Best Rgds, Simonf :cool:
    __________________________________
    My Site | E-Mail Me

  2. #2
    Join Date
    Nov 2014
    Location
    On A Scottish Island
    Posts
    413
    Thanks
    0
    Thanked 47 Times in 44 Posts

  3. #3
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,078
    Thanks
    1
    Thanked 204 Times in 200 Posts

    Default

    Hi there simonf,

    check out the attachment, which contains a fully working example.

    coothead
    Attached Files Attached Files
    ~ the original bald headed old fart ~

  4. #4
    Join Date
    Sep 2004
    Location
    Little Falls, Roodepoort, South Africa
    Posts
    406
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default

    Hi

    Thanks will check it out
    Very Best Rgds, Simonf :cool:
    __________________________________
    My Site | E-Mail Me

Similar Threads

  1. Replies: 8
    Last Post: 12-08-2016, 10:55 PM
  2. Image Thumbnail Viewer- Adding a "Print Page" option.
    By Bill in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 06-24-2009, 01:54 AM
  3. "print this page" ?
    By soscopyrights in forum PHP
    Replies: 7
    Last Post: 02-02-2007, 04:08 AM
  4. Script for "email a friend" and "print page"
    By pernes in forum JavaScript
    Replies: 0
    Last Post: 11-30-2005, 07:31 PM

Tags for this Thread

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
  •