사이트 내 전체검색
PHP
[Javascript]원하는 HTML 영역 프린트하기
로빈아빠
https://cmd.kr/php/903 URL이 복사되었습니다.

본문

onPrint() {
const html = document.querySelector('html');
const printContents = document.querySelector('.modal-body').innerHTML;
const printDiv = document.createElement("DIV");
printDiv.className = "print-div";
 
html.appendChild(printDiv);
printDiv.innerHTML = printContents;
document.body.style.display = 'none';
window.print();
document.body.style.display = 'block';
printDiv.style.display = 'none';
}

출처 : https://milooy.wordpress.com/2017/03/28/javascript-print-page/

댓글목록

등록된 댓글이 없습니다.

PHP
871 (1/18P)

Search

Copyright © Cmd 명령어 3.135.230.164