원하는 부분만 인쇄하기

| 2006.05.05

<head> 와 </head> 사이에 아래의 스크립트 소스를 삽입합니다.

<script type="text/javascript">
        var initBody
        function beforePrint()
        {
         initBody = document.body.innerHTML;
         document.body.innerHTML = DaeRewPrint.innerHTML;
        }

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

        function printdaerew()
        {
         window.print();
        }

        window.onbeforeprint = beforePrint;
        window.onafterprint = afterPrint;
</script>


그 다음 인쇄할 부분을 아래와 같이 <div> 나 <table> 에 id 를 부여해서 삽입합니다.

예제) <div id="DaeRewPrint"> 대류커뮤니티에 오신 것을 환영합니다.</div>

마지막으로 출력버튼을 삽입합니다.

<input type="button" value="인쇄" onclick="printdaerew();">

이미지로 하신 분들은 아래와 같이합니다.

<image src="/images/etc/icon_page_print.gif" onclick="printArea();" style="cursor:pointer;">