게시판 내용 출력
관련링크
http://게시판 인쇄 출력
54회 연결
본문
/theme/dam/skin/board/online/view.skin.php
<section id="bo_v_atc bo_v_con">
<h2 id="bo_v_atc_title">본문</h2>
<script>
$(function() {
//프린트 이벤트 바인딩
$(".btn_print").on("click", function() {
domPrint( $("#bo_v_con")[0] );
//domPrint( document.getElementById("bo_v_con") );
});
});
</script>
<a href="javascript:" OnClick="content_print();" class="btn_print"><span class="icon_print"></span>출력</a>
<div class="view-data">
<h3 class="titBox-c"><span>신청내역</span></h3>
<ul class="view_opt mb40">
<li><span>프로그램명</span><?php echo $view['wr_subject'] ?></li>
<li><span>담당자 이름</span><?php echo $view['wr_11'] ?></li>
<li><span>휴대폰 번호</span><a href="tel:<?php echo $view['wr_8'] ?>"><?php echo $view['wr_8'] ?></a></li>
<li><span>이메일</span><?php echo $view['wr_email'] ?></li>
<li><span>희망일시</span><?php echo $view['wr_5'] ?> ~ <?php echo $view['wr_6'] ?> /총 <?php echo $view['wr_7'] ?>시간</li>
<li><span>대상</span><?php echo $view['wr_17'] ?> </li>
<li><span>인원수</span><?php echo $view['wr_9'] ?>학년 / 총 <?php echo $view['wr_10'] ?>명</li>
<li><span>장소</span><?php echo $view['wr_14'] ?> <?php echo $view['wr_14']=='(교실)'?$view['wr_15']:"";?> <?php echo $view['wr_15'] ?><?php echo $view['wr_14']=='(기타)'?$view['wr_16']:"";?> <?php echo $view['wr_16'] ?></li>
</ul>
</div>
</section>
html/js/common.php
//출력
function domPrint(obj) {
var newWin = window.open("출력창","_blank");
var doc = obj.innerHTML;
newWin.document.write(doc);
newWin.document.close();
newWin.print();
newWin.close();
}
이렇게 했는데 출력 버튼을 누르면 찾을 수 없는 경로라고 떠요~
디자이너입니다~
!-->!-->답변 1
var newWin = window.open("출력창","_blank");
대신
var newWin = window.open("","_blank");
https://developer.mozilla.org/en-US/docs/Web/API/Window/open
답변을 작성하시기 전에 로그인 해주세요.