본문 바로가기

레이어를 이용한 특정 범위 인쇄

MintState 2008년 11월 10일 오전 11:44 조회 13515

레이어를 이용한 특정 범위 인쇄

<script>
var initBody;
function beforePrint()
{ 
   initBody = document.body.innerHTML; 
   document.body.innerHTML = div_page.innerHTML;
} 

function afterPrint()
{ 
  document.body.innerHTML = initBody; 
} 

function pageprint()
{
     window.onbeforeprint = beforePrint; 
     window.onafterprint = afterPrint; 
     window.print(); 
}
</script>
<a href="#" onclick="pageprint()"> 인쇄하기</a>

<div id="div_page">
여기만 인쇄

여기만 인쇄

여기만 인쇄

여기만 인쇄
</div>
공유 X Facebook LINE QR 코드

댓글 0개

첫 댓글을 남겨보세요.