기존에 대부분 스킨에서 프린트 기능을 구현하려면,
간단하게는 window.print(); 를 사용해서 전체를 프린트 하게 하거나...
새창으로 띄워서 새창 전체를 프린트하는 기법을 사용하는데...
새창안을 띄우지 않고 필요한 부분만 프린트하는 소스입니다.
일단 게시물 본문만 프린트 하려면 아래와 같이 추가해 주시면 됩니다.
<iframe name=print_content id=print_content width=1 height=1 style="visibility:hidden;"></iframe>
<script>
function content_printer ()
{
print_content.document.open();
print_content.document.writeln("<html><head><style>body,td,p,pre,input,textarea,select,option,a,a:hover {font-size:9pt; font-family:tahoma,굴림;}</style></head><body>"); //스타일등을 지정
print_content.document.writeln('<?=$memo?>'); // 본문 출력
print_content.document.writeln("</body></html>");
print_content.document.close();
print_content.document.execCommand('Print');
}
</script>
<a onclick="content_printer();" style="cursor:hand;">프린트하기</a>
간단하게는 window.print(); 를 사용해서 전체를 프린트 하게 하거나...
새창으로 띄워서 새창 전체를 프린트하는 기법을 사용하는데...
새창안을 띄우지 않고 필요한 부분만 프린트하는 소스입니다.
일단 게시물 본문만 프린트 하려면 아래와 같이 추가해 주시면 됩니다.
<iframe name=print_content id=print_content width=1 height=1 style="visibility:hidden;"></iframe>
<script>
function content_printer ()
{
print_content.document.open();
print_content.document.writeln("<html><head><style>body,td,p,pre,input,textarea,select,option,a,a:hover {font-size:9pt; font-family:tahoma,굴림;}</style></head><body>"); //스타일등을 지정
print_content.document.writeln('<?=$memo?>'); // 본문 출력
print_content.document.writeln("</body></html>");
print_content.document.close();
print_content.document.execCommand('Print');
}
</script>
<a onclick="content_printer();" style="cursor:hand;">프린트하기</a>
댓글 10개
냠냠;;;;;;;;;
<script>
function printHTML() {
Pwin = window.open("","","width=900,height=800,scrollbars=1");
wdata ="<HTML>";
wdata += document.getElementById("print").innerHTML;
wdata += "";
Pwin.document.write(wdata);
Pwin.window.print();
Pwin.window.location.reload();
}
</script>
<div id="print">
프린트할부분을 div로 감싸준다
</div>
저는 이거 쓰는데..........
<script>
function printHTML() {
Pwin = window.open("","","width=900,height=800,scrollbars=1");
wdata ="<HTML>";
wdata += document.getElementById("print").innerHTML;
wdata += "";
Pwin.document.write(wdata);
Pwin.window.print();
Pwin.window.location.reload();
}
</script>
<div id="print">
프린트할부분을 div로 감싸준다
</div>
저는 이거 쓰는데..........
게시글 목록
| 번호 | 제목 |
|---|---|
| 11040 |
JavaScript
자바스크립트를 이용해 모니터 해상도 구하기
2
|
| 11037 |
JavaScript
모바일 접속시 모바일 페이지로 이동하기
2
|
| 11028 |
MySQL
SQL 문장의 실행순서
8
|
| 11019 |
MySQL
초보자들을 위한 팁(count편)
8
|
| 11017 | |
| 11012 |
MySQL
트리거를 이용한 날짜 자동 업데이트
4
|
| 10999 |
PHP
배열 순서 섞기
12
|
| 10990 |
JavaScript
체크박스 전체선택/해제/반전
8
|
| 10984 |
JavaScript
마우스휠이벤트 등록 및 활용
5
|
| 20478 | |
| 20151 | |
| 10973 |
JavaScript
부분 프린터하기
10
현재글
|
| 10970 |
JavaScript
GET으로 넘어온 파라미터 가져오기
2
|
| 10966 |
JavaScript
첨부파일 확장자 체크 [정규식]
3
|
| 10962 |
JavaScript
iframe 아이프레임 투명처리
3
|
| 10961 | |
| 10959 |
PHP
주민번호 검사기
1
|
| 10958 | |
| 10951 |
JavaScript
화면 줌(ZOOM); 필요한분이 있으려나...;
6
|
| 10947 | |
| 10945 | |
| 10944 |
PHP
utf8 체크하기
|
| 20463 | |
| 10943 | |
| 10939 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기