기존에 대부분 스킨에서 프린트 기능을 구현하려면,
간단하게는 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>
저는 이거 쓰는데..........
게시글 목록
| 번호 | 제목 |
|---|---|
| 12487 |
PHP
pc 모바일 체크
|
| 12486 |
PHP
계정 사용량(용량) 확인
|
| 380 | |
| 12484 | |
| 12483 |
MySQL
소수점 반올림 버림
|
| 376 | |
| 12482 | |
| 12481 |
PHP
에러 로그파일 생성하기
|
| 12479 | |
| 12478 | |
| 12477 |
PHP
후이즈검색 하기 입니다.
|
| 12476 |
PHP
그래프 그리기 입니다.
|
| 12475 |
JavaScript
자바스크립트로 구현한 number_format() 입니다.
|
| 12474 |
JavaScript
금액 관련 숫자를 한글로 변환하기 입니다.
|
| 12473 |
PHP
PHP 날짜 계산 관련 함수
|
| 12472 |
jQuery
jQuery 1.x와 2.x 버전 동시에 사용하기
|
| 12471 | |
| 12470 | |
| 12469 |
JavaScript
사업자 등록번호 검사하기 입니다.
|
| 371 | |
| 12468 | |
| 12467 |
JavaScript
항상 같은곳에 광고창 만들기 입니다.
|
| 12466 |
JavaScript
부메뉴 나오게 하기 입니다.
|
| 12465 |
JavaScript
특정문자 제거하기 입니다.
|
| 12464 |
JavaScript
휴대폰번호 검사 하기 입니다.
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기