html에서 div로 지정한 특정 영역만 인쇄하기 / Print only specific areas designated as div in html
작성자 정보
- 삼둡 작성
- 작성일
컨텐츠 정보
- 4,342 조회
- 목록
본문
<a href="#" onclick="printArea()">인쇄하기NEW</a>
적당한 곳에 인쇄 링크를 넣는다.
Put the print link in the appropriate place as above.

<!-- 엣지때문에 2022-12월에 추가함 -->
<script type="text/javascript">
<!--
var initBody;
function beforePrint() {
boxes = document.body.innerHTML;
document.body.innerHTML = box.innerHTML;
}
function afterPrint() {
document.body.innerHTML = boxes;
}
function printArea() {
window.print();
}
window.onbeforeprint = beforePrint;
window.onafterprint = afterPrint;
-->
</script>
이러한 스크립트를 head 안에 body 위 정도 적당한 곳에 넣는다.
Put these scripts in the head in the right place above the body.

<div ID="box">
<table border=1 cellspacing=0 width=350>
.....
</div>
인쇄를 원하는 영역에 div로 box를 지정한다.
Specify the box as a div in the area you want to print.
관련자료
-
이전
-
다음
댓글 0
등록된 댓글이 없습니다.