본문 바로가기

Html,Css,JavaScript

프린트 스크립트

특정영역을 출력하는데 좋은 방법인듯...


<SCRIPT LANGUAGE="JavaScript">
    <!--
    function mapPrint() {
     var p = document.getElementById("printContent").innerHTML;
     var width = 1;
     var height = 1;
     tmp = window.open("", "printContent",
"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,
width="+width+",height="+height+",top=3,left=2000");"toolbar=0,location=0,directories=0,status=0,menubar=0,
scrollbars=1,resizable=1,copyhistory=0,width="+width+",height="+height+",top=3,left=2000");
     tmp.document.open();
     tmp.document.write("<html><head><title>AD Spring Map</title></head>");
     tmp.document.write("<body leftmargin=0 topmargin=0 onload=\"window.print();self.close();\">");
     tmp.document.write(p);
     tmp.document.write("</body></html>"); tmp.document.write("</body></html>");
     tmp.document.close();
    }
    //-->
</SCRIPT>

<form name="print">
<div id="printContent">프린트 할 내용</div>
</form></form>

<a href="#" onclick="mapPrint(); return false; ">인쇄</a>


[출처] 웹 뒤에 숨은 Web