View Single Post
  #3 (permalink)  
Old Apr 21st, 2008, 13:33
spinal007's Avatar
spinal007 spinal007 is offline
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: Printing a piece of a webpage

I think I see where you're going and it can be done as long as each heading has its relevant content within a corresponding DIV, with some sort of ID.

Example: (hand coded on the fly, not tested, but you'll get the gist)
Code: Select all
<h2 id="SectionX" onclick="PrintSection(this)">Section X</h2>
<div id="SectionXContent"> blah blah blah </div>
<script>
function PrintSection(section){
 var wind = window.open('about:blank');
 var html = document.getElementById(section.id + 'Content').innerHTML;
 wind.document.body.innerHTML = html;
 wind.print();
}
</script>
Reply With Quote