<html파일>

<div id="print_content">

<table>

  <tr>

    <td>출력할 부분</td>

  </tr>

</table>

</div>

 

<a href="javascript:print_content('serviceaddress');"><img src="img/button2.gif" border="0" width="57" height="22" style="cursor:hand"/></a>                                   

 

[js파일]

/* 특정 부분을 출력할때 쓰임 */
function print_content(p_service){
 //alert("dfdf");
 window.open("/html/print_content.html","","directories=0,location=0,menubar=0,scrollbars=0,toolbar=0,width=500,height=500, left=5000, top=5000;");

// left와 top의 위치를 5000으로 해서 화면에는 안보이게 한다.
}

 

[print_content.html]

<html>
<head>
<link rel="stylesheet" type="text/css" href="/ktf/css/css.css">
</head>
<body onLoad="window.close();">
<form name="testform">
<input type="hidden" name="data" value>
</form>
<script language="javascript">
 {
  var print_all;
  (document.testform.data.value = window.opener.document.all.print_content.innerHTML);
  print_all = (document.testform.data.value);
  document.write (print_all);
  window.print();
 }
</script>
</body>
</html>

*********************************************************

출력버튼을 클릭하면 출력하는 화면이 뜨고 인쇄를 클릭하면

div태그에 쌓여진 부분만 출력하게 된다..

from.  http://blog.naver.com/flydrago?Redirect=Log&logNo=40005671910   김경용

'프로그래밍Tips' 카테고리의 다른 글

JAD, JADClipse 설치하기  (2) 2009.09.07
Tomcat DOC ROOT 변경 및 Deploy 방법  (0) 2009.03.23
솔라리스에서 ifconfig 설정하기  (0) 2008.09.29

+ Recent posts