I want to print a particular frame in an array indexed by name. I am using the following code:
var frame_name = "abc";
frames_array[frame_name].focus();
frames_array[frame_name].print();
When it executes print() statement in IE8, it hangs. This piece of code works correctly in Firefox, Chrome and IE9.
I tried frames_array[frame_name].document.close() but it did not change anything. Is there a solution to this problem?
Try like this function.It will work.
function printDiv() {
var divToPrint = document.getElementById('printArea');
newWin.document.write(divToPrint.innerHTML)
newWin.document.close();
newWin.focus();
newWin.print();
newWin.close();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With