Print div element doesn't work for IE?

后端 未结 1 1662
没有蜡笔的小新
没有蜡笔的小新 2021-01-24 11:43

I have a dynamic div class. The elements inside the div are dynamically populated through backend ajax web service requests. :-

相关标签:
1条回答
  • 2021-01-24 12:19

    Here is the code which I'm using to print a DIV content, and its working fine in IE as well,

        function printPartOfPage(elementId) {
            var printContent = document.getElementById(elementId);
            var windowUrl = 'Job Receipt';
            var uniqueName = new Date();
            var windowName = 'Print' + uniqueName.getTime();
            var printWindow = window.open(windowUrl, windowName, 'left=50000,top=50000,width=0,height=0');
            printWindow.document.write(printContent.innerHTML);
            printWindow.document.close();
            printWindow.focus();
            printWindow.print();
            printWindow.close();
        }
    

    Please try this code

    0 讨论(0)
提交回复
热议问题