Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP! how to print a SCROLLABLE DIV element

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi all!
I have a BAD problem!
The website I'm building is structured as a frameset containing an always-present top header frame (with nav bar) and a content-frame.
The stuff in the content frame is all enclosed in a <div class=&quot;contentCanvas&quot;> element, styled with an external CSS, which forces the content in it to be scrolled when it reaches its maximum size.

DIV.contentCanvas {
background: #E5F4F5;
width: 650px;
height: 100%;
overflow: auto;
text-align: center;
}

Now, my problem is that I can not PRINT the full content of the content frame because the overflow property is not followed by the browser when printing!!!
So I have made a simple javascript in the nav bar (in the header frame) that says to print only the content frame, changing &quot;that&quot; CSS line:

<!-- BEGIN Print Content-Frame Script ----------->
<script language=&quot;JavaScript&quot;><!--
function printit() {
var contentToPrint = parent.content;
contentToPrint.focus();
contentToPrint.document.styleSheets[0].rules[7].style.overflow='visible';
contentToPrint.print();
contentToPrint.document.styleSheets[0].rules[7].style.overflow='auto';

}
//-->
</script>
<!-- END Print Content-Frame Script ----------->

BUT THIS THING DOES NOT WORK!!!
Well, the stylesheet is modified but printing ignore it...
Note: if I do change manually the CSS setting overflow to visible, printing WORKS... but of course I lose the scroll-property for my texts...

The website I'm talking about is but I've modified only my local version for now...
Anything about this case?


Thanx, mcd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top