“Cetak Isi Div” Kode Jawaban

HTML Print Div

function PrintElem(elem)
{
    var mywindow = window.open('', 'PRINT', 'height=400,width=600');

    mywindow.document.write('<html><head><title>' + document.title  + '</title>');
    mywindow.document.write('</head><body >');
    mywindow.document.write('<h1>' + document.title  + '</h1>');
    mywindow.document.write(document.getElementById(elem).innerHTML);
    mywindow.document.write('</body></html>');

    mywindow.document.close(); // necessary for IE >= 10
    mywindow.focus(); // necessary for IE >= 10*/

    mywindow.print();
    mywindow.close();

    return true;
}
VasteMonde

Cetak Isi Div

function printDiv(divName){
			var printContents = document.getElementById(divName).innerHTML;
			var originalContents = document.body.innerHTML;

			document.body.innerHTML = printContents;

			window.print();

			document.body.innerHTML = originalContents;

		}
John Mark Tamaño

Jawaban yang mirip dengan “Cetak Isi Div”

Pertanyaan yang mirip dengan “Cetak Isi Div”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya