원하는 부분만 프린트하기
<html>
<head>
<title> 원하는 부분만 인쇄하기 </title>
<script language="javascript">
var initBody
function beforePrint() {
initBody = document.body.innerHTML;
document.body.innerHTML = idPrint.innerHTML;
}
function afterPrint() {
document.body.innerHTML = initBody;
}
function printArea() {
window.print();
}
window.onbeforeprint = beforePrint;
window.onafterprint = afterPrint;
</script>
</head>
<body>
기본 문서 내용...<br> . <br> . <br> . <br>
인쇄할 때 제외될 영역 입니다. <br><br>
<div id="idPrint"> 이 부분만 인쇄를 하고 싶습니다. <br> </div>
<input type="button" value="부분 출력하기" onclick="printArea();">
</body>
</html>
반응형
'Information' 카테고리의 다른 글
| 텍스트박스 클릭시 기본값 없애기 (0) | 2007.03.26 |
|---|---|
| 체크박스 전체선택 (0) | 2007.03.26 |
| style에서 display, visibility의 차이점.. (0) | 2007.03.25 |