marshallhansen
06-01-2005, 09:23 PM
I am trying to do a print preview in a new window. I want only the main content area to come up in the new window. I have a script that will grab everything inside a div and throw it in a new window, but it will not transfer anything inside any other tags inside the div.
This is my function that I call...
<script LANGUAGE="JavaScript">
function displayHTML() {
var inf = document.getElementById('printarea').innerHTML;
win = window.open("print.htm", 'popup', 'toolbar = no, status = no');
win.document.write(inf + "<br /><a href='javascript:print()'>print</a>");
win.document.close();
}
</script>
What doesn't work though is if I have
<div id="printarea">adf
<table><tr><td>content here</td></tr></table>
</div>
With this what I get in the new window is the "adf" not the table.
This is my function that I call...
<script LANGUAGE="JavaScript">
function displayHTML() {
var inf = document.getElementById('printarea').innerHTML;
win = window.open("print.htm", 'popup', 'toolbar = no, status = no');
win.document.write(inf + "<br /><a href='javascript:print()'>print</a>");
win.document.close();
}
</script>
What doesn't work though is if I have
<div id="printarea">adf
<table><tr><td>content here</td></tr></table>
</div>
With this what I get in the new window is the "adf" not the table.