<script language="JavaScript">
var initBody;
function beforePrint() {
calendars = document.body.innerHTML;
document.body.innerHTML = calendar.innerHTML;
}
function afterPrint() {
document.body.innerHTML = calendars;
}
function printArea() {
window.print();
window.close();
}
window.onbeforeprint = beforePrint;
window.onafterprint = afterPrint;
</script>
<div id="calendars"></div>
자바스크립트 부분에 위에 함수를 선언해 주고
body부분에 출력하고자 하는 부분을 div로 감싸 준다.
'STUDY > WEB' 카테고리의 다른 글
[html] submit/image 버튼 클릭시 함수 하나만 실행 (0) | 2016.08.30 |
---|---|
[html] 엔터키로 이벤트 실행 (0) | 2016.08.30 |
[html] 스크롤 처리 Thead고정 TBody만 움직임 (0) | 2016.08.30 |
[javascript] replaceAll (0) | 2016.08.30 |
[html] 기호 (0) | 2016.08.30 |