Homesick
08-25-2010, 07:49 AM
Hi guys ,, I am new here
could you please help me in this:
I have multiple divs something like this
<div id="div1">
<div id="div2">
<div id="div3">
....
</div>
</div>
I want JavaScript code to print div1 with all nested divs as well
I tried using the following code but it only print div1 content
var printContent = document.getElementById('div1');
var windowUrl = 'about:blank';
var uniqueName = new Date();
var windowName = 'Print' + uniqueName.getTime();
var printWindow = window.open(windowUrl, windowName, 'left=50000,top=50000,width=200,height=200');
printWindow.document.write(printContent.innerHTML);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
so please tell me how to do such operation ??
could you please help me in this:
I have multiple divs something like this
<div id="div1">
<div id="div2">
<div id="div3">
....
</div>
</div>
I want JavaScript code to print div1 with all nested divs as well
I tried using the following code but it only print div1 content
var printContent = document.getElementById('div1');
var windowUrl = 'about:blank';
var uniqueName = new Date();
var windowName = 'Print' + uniqueName.getTime();
var printWindow = window.open(windowUrl, windowName, 'left=50000,top=50000,width=200,height=200');
printWindow.document.write(printContent.innerHTML);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
so please tell me how to do such operation ??