simonf
07-10-2017, 11:55 AM
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/ (https://jsfiddle.net/SimonRWFish/3e462gqa/2/)
Code I'm trying to use is
<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/assets/css/stestyle.css
Logo would be "smlogosprite"
Any help , advice is appreciated as always....
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/ (https://jsfiddle.net/SimonRWFish/3e462gqa/2/)
Code I'm trying to use is
<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/assets/css/stestyle.css
Logo would be "smlogosprite"
Any help , advice is appreciated as always....