초보 인쇄하기 질문드립니다.
본문
아래 소스에서 빨간색 부분만 인쇄를 하고싶은데 고수님들 방법좀 알려주세요"감사합니다" 꾸벅
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<div style='height:20px;'> </div>
<!-- 게시글 보기 시작 -->
<table width="<?=$width?>" cellpadding="0" cellspacing="0"><tr><td>
<table width="100%" border='0' cellpadding='0' cellspacing='0'>
<tr>
<td height="100" align="left"><a href="<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>" target="_self"><b style="font-size:35px; color:595959;">
<?=$board[bo_subject]?></b></a></td>
<td align="center" width="100" height="34"><a href="javascript:window.print();">
<img src="<?=$g4['path']?>/img/btn_print.gif" border="0" width="100" height="34" title="인쇄하기"</a></td>
</tr>
</table>
<table width='100%' border='0' cellpadding='0' cellspacing='0'>
</tr>
</table>
</div>
<div style="font-size:1px; line-height:1px; background-image:url('<?=$board_skin_path?>/img/title_shadow.gif'); background-repeat:repeat-x; height:0px;"></div>
<table width='100%' border="0" cellspacing="0" cellpadding="0"></tr></table>
<table width="800" align="center" style="border:5px solid 8c0012;">
<tr><td align='center'><b style="font-size:70px; color:cf001b;"><?php echo $view[subject] ?>
<tr><td align='center'><b style=font-size:50px><?=$view[wr_10]?></td></tr>
<?
// 가변 파일
$cnt = 0;
for ($i=0; $i<count($view[file]); $i++) {
if ($view[file][$i][source] && !$view[file][$i][view]) {
$cnt++;
echo "<tr><td height=30 background=\"$board_skin_path/img/view_dot.gif\">";
echo " <img src='{$board_skin_path}/img/icon_file.gif' align=absmiddle border='0'>";
echo " <a href=\"javascript:file_download('{$view[file][$i][href]}', '{$view[file][$i][source]}');\" title='{$view[file][$i][content]}'>";
echo "<span style=\"color:#888; font-size:11px;\">{$view[file][$i][source]} ({$view[file][$i][size]})</span></a>";
echo " <span style=\"color:#ff6600; font-size:11px;\">[{$view[file][$i][download]}]</span>";
echo " <span style=\"color:#d3d3d3; font-size:11px;\">DATE : {$view[file][$i][datetime]}</span>";
echo "</td></tr>";
}
}
// 링크
$cnt = 0;
for ($i=1; $i<=$g4[link_count]; $i++) {
if ($view[link][$i]) {
$cnt++;
$link = cut_str($view[link][$i], 70);
echo "<a href='{$view[link_href][$i]}' target=_blank>";
echo "</a></td></tr>";
}
}
?>
<tr>
<td height="150" valign="top" align="center" bgcolor="white" style="word-break:break-all; padding:0px 0 0px 0;">
<?
// 파일 출력
for ($i=0; $i<=count($view[file]); $i++) {
if ($view[file][$i][view])
echo $view[file][$i][view] . "<p>";
}
?>
<tr><td align="center" style="font-size:35px; color:595959;">제목</td></tr>
<tr><td style="word-break:break-all; padding:0 0 0 70px;"><b style="font-size:35px; color:8c0012;">점주 : <?=$view[wr_3]?>[<?=$view[wr_4]?>] 점포명 : <?=$view[wr_6]?></td></tr>
<tr><td style="word-break:break-all; padding:0 0 0 70px;"><b style=font-size:40px height='50'>거래날짜 : <?=$view[wr_7]?></td></tr>
<tr><td style="word-break:break-all; padding:0 0 0 70px;"><b style=font-size:40px height='50'>거래시간 : <?=$view[wr_8]?></td></tr>
<tr><td style="word-break:break-all; padding:0 0 0 70px;"><b style=font-size:40px height='50'>참고내용 : <?=$view[wr_9]?></td></tr>
<tr><td align=center style="font-size:35px; color:595959;" height='50'>비고</td></tr>
<tr><td align=center style="font-size:35px; color:595959;" height='50'><?=date("Y m d strtotime($view[wr_5]))?></td></tr>
</table>
<? if ($nogood_href) {?>
<div style="width:72px; height:55px; background:url(<?=$board_skin_path?>/img/good_bg.gif) no-repeat; text-align:center; float:right;">
<div style="color:gray; margin-top:7px; margin-right:0; margin-bottom:5px; margin-left:0;">비추 : <?=number_format($view[wr_nogood])?></div>
<div><a href="<?=$nogood_href?>" target="hiddenframe"><img src="<?=$board_skin_path?>/img/icon_nogood.gif" border='0' align="absmiddle"></a></div>
</div>
<? } ?>
<? if ($good_href) {?>
<div style="width:72px; height:55px; background:url(<?=$board_skin_path?>/img/good_bg.gif) no-repeat; text-align:center; float:right;">
<div style="color:gray; margin-top:7px; margin-right:0; margin-bottom:5px; margin-left:0;"><span style='color:crimson;'>좋와요 : <?=number_format($view[wr_good])?></span></div>
<div><a href="<?=$good_href?>" target="hiddenframe"><img src="<?=$board_skin_path?>/img/icon_good.gif" border='0' align="absmiddle"></a></div>
</div>
<? } ?>
</td>
</tr>
<? if ($is_signature) { echo "<tr><td align='center' style='border-bottom:1px solid #E7E7E7; padding:5px 0;'>$signature</td></tr>"; } // 서명 출력 ?>
</table>
<br>
<?
// 코멘트 입출력
include_once("./view_comment.php");
?>
<div style="font-size:1px; line-height:1px; background-color:rgb(208,208,208); height:1px; clear:both;"> </div>
<div style="height:43px; clear:both;">
<div style="margin-top:10px; float:left;">
<? if ($prev_href) { echo "<a href=\"$prev_href\" title=\"$prev_wr_subject\"><img src='$board_skin_path/img/btn_prev.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($next_href) { echo "<a href=\"$next_href\" title=\"$next_wr_subject\"><img src='$board_skin_path/img/btn_next.gif' border='0' align='absmiddle'></a> "; } ?>
</div>
<!-- 링크 버튼 -->
<div style="margin-top:10px; float:right;">
<?
ob_start();
?>
<? if ($copy_href) { echo "<a href=\"$copy_href\"><img src='$board_skin_path/img/btn_copy.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($move_href) { echo "<a href=\"$move_href\"><img src='$board_skin_path/img/btn_move.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($search_href) { echo "<a href=\"$search_href\"><img src='$board_skin_path/img/btn_list_search.gif' border='0' align='absmiddle'></a> "; } ?>
<? echo "<a href=\"$list_href\"><img src='$board_skin_path/img/btn_list.gif' border='0' align='absmiddle'></a> "; ?>
<? if ($update_href) { echo "<a href=\"$update_href\"><img src='$board_skin_path/img/btn_modify.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($delete_href) { echo "<a href=\"$delete_href\"><img src='$board_skin_path/img/btn_delete.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($reply_href) { echo "<a href=\"$reply_href\"><img src='$board_skin_path/img/btn_reply.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($write_href) { echo "<a href=\"$write_href\"><img src='$board_skin_path/img/btn_write.gif' border='0' align='absmiddle'></a> "; } ?>
<?
$link_buttons = ob_get_contents();
ob_end_flush();
?>
</div>
</div>
<div style="font-size:1px; line-height:1px; background-color:rgb(222,222,222); height:2px; clear:both;"> </div>
</td>
</tr>
</table>
<table align="center" width="100%" bgcolor="white" border="0" cellspacing="10" cellpadding="0">
<tr>
<td align="center" background="<?=$g4['path']?>/img/copyright.gif"></td>
</tr>
<tr>
<td align="center" valign="top" height="0">
<font color="999999"></font></td>
</tr>
<br>
<script type="text/javascript">
function file_download(link, file) {
<? if ($board[bo_download_point] < 0) { ?>if (confirm("'"+file+"' 파일을 다운로드 하시면 포인트가 차감(<?=number_format($board[bo_download_point])?>점)됩니다.
\n\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\n\n그래도 다운로드 하시겠습니까?"))<?}?>
document.location.href=link;
}
</script>
<script type="text/javascript" src="<?="$g4[path]/js/board.js"?>"></script>
<script type="text/javascript">
window.onload=function() {
resizeBoardImage(<?=(int)$board[bo_image_width]?>);
//drawFont();
}
function image_window(){ return; }
</script>
<!-- 게시글 보기 끝 -->
답변 2
div 로 감싸세요
그리고 그 div 만 인쇄!
function info_print() {
var initBody = document.body.innerHTML;
window.onbeforeprint = function () {
document.body.innerHTML = document.getElementById("test").innerHTML;
}
window.onafterprint = function () {
document.body.innerHTML = initBody;
}
window.print();
}
빨간색부분만 인쇄버튼(임의의버튼)
새창에 한번더 띄워서 인쇄를 하세요
혹은 아이프레임도 괜찮습니다