검색을 하면 undefined 할 게시물을 선택하라고 나옵니다
본문
스킨을 짜집기 해서 만들었는데 검색을 하면 저런 경고문이 나옵니다..
소스는 아래와 같습니다..혹시 도와주실수 있을까요 ㅠㅠ
<?php if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가 include_once(G5_LIB_PATH.'/thumbnail.lib.php'); // 선택옵션으로 인해 셀합치기가 가변적으로 변함 $colspan = 2; if ($is_checkbox) $colspan++; // add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨 add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0); ?> <style> #mgmap { width: 100%; height:800px; margin:0; padding: 0px; border: 0px; } </style> <h2 id="container_title"><?php echo $board['bo_subject'] ?><span class="sound_only"> 목록</span></h2> <br /><br /> <!-- 게시판 목록 시작 --> <div id="bo_list<?php if ($is_admin) echo "_admin"; ?>"> <!-- 카테고리 기본 시작 --> <?php if ($is_category) { ?> <nav id="bo_cate"> <h2><?php echo $board['bo_subject'] ?> 카테고리</h2> <ul id="bo_cate_ul"> <?php echo $category_option ?> </ul> </nav> <?php } ?> <!-- 카테고리 기본 끝 --> <div class="bo_fx"> <div id="bo_list_total"> <span>DB <?php echo number_format($total_count) ?>ea</span> </div> <?php if ($rss_href || $write_href) { ?> <ul class="btn_bo_user"> <?php if ($rss_href) { ?><li><a href="<?php echo $rss_href ?>" class="btn_b01">RSS</a></li><?php } ?> <?php if ($admin_href) { ?><li><a href="<?php echo $admin_href ?>" class="btn_admin">관리자</a></li><?php } ?> <?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php } ?> </ul> <?php } ?> </div> <form name="fboardlist" id="fboardlist" action="./board_list_update.php" onsubmit="return fboardlist_submit(this);" method="post"> <input type="hidden" name="bo_table" value="<?php echo $bo_table ?>"> <input type="hidden" name="sfl" value="<?php echo $sfl ?>"> <input type="hidden" name="stx" value="<?php echo $stx ?>"> <input type="hidden" name="spt" value="<?php echo $spt ?>"> <input type="hidden" name="sst" value="<?php echo $sst ?>"> <input type="hidden" name="sod" value="<?php echo $sod ?>"> <input type="hidden" name="page" value="<?php echo $page ?>"> <input type="hidden" name="sw" value=""> <!--지도 시작 --> <div id="mgmap"></div> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&language=ko®ion=kr&key=키값"></script> <script src="<?=$board_skin_url?>/markerclusterer.js" type="text/javascript"></script> <script type="text/javascript"> var map; var ymakcur; var ymakcurOptions = {styles:[{ height: 20, width: 20, url: '<?=$board_skin_url?>/img/ymc1.png', }],gridSize: 1, maxZoom: 1}; var infowindow = new google.maps.InfoWindow(); var geocoder = new google.maps.Geocoder(); var bounds = new google.maps.LatLngBounds(); var ymakerimg = '<?php echo $board_skin_url ?>/img/mapicon001.png'; var address = new Array( <? for ($i=0; $i<count($list); $i++) { $ylat=($list[$i][wr_4]); $ylng=($list[$i][wr_5]); ?> "<?=$ylat?>,<?=$ylng?>" <? if ($i==count($list)-1) continue; ?> , <? } ?> ); var ca_name = new Array( <? for ($i=0; $i<count($list); $i++) { $ca_name=($list[$i][ca_name]); ?> "<?=$ca_name?>" <? if ($i==count($list)-1) continue; ?> , <? } ?> ); var content = new Array( <? for ($i=0; $i<count($list); $i++) { $name1=strip_tags($list[$i][wr_subject]); $address=strip_tags($list[$i][wr_2]); $etc=strip_tags($list[$i][wr_7]); $byul=strip_tags($list[$i][wr_8]); $hit=strip_tags($list[$i][wr_hit]); $bylink=($list[$i][wr_id]); $mtem="<a href={$list[$i][href]} target=_blank><strong>$name1</strong></a></p>$etc</p>$byul ($hit)"; ?> "<?=$mtem?>" <? if ($i==count($list)-1) continue; ?> , <? } ?> ); var min = .999999; var max = 1.000001; function createMarker(latlng,text,ymakerimg) { var marker = new google.maps.Marker({ position: latlng, icon : ymakerimg, map: map }); bounds.extend(latlng); map.fitBounds(bounds); var allMarkers = ymakcur.getMarkers(); if (allMarkers.length != 0) { for (i=0; i < allMarkers.length; i++) { var existingMarker = allMarkers[i]; var pos = existingMarker.getPosition(); if (latlng.equals(pos)) { text = text + "<hr>" + content[i]; } } } google.maps.event.addListener(marker, 'click', function() { infowindow.close(); infowindow.setContent(text); infowindow.open(map,marker); }); ymakcur.addMarker(marker); return marker; } var options = { zoom: 4, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById('mgmap'), options); var ycmarkers = []; ymakcur = new MarkerClusterer(map, [], ymakcurOptions); for (i=0; i<address.length; i++) { var ymSarang = address[i]; var jumcok = ymSarang.split(","); var latlng = new google.maps.LatLng(parseFloat(jumcok[0]),parseFloat(jumcok[1])); if(ca_name[i]=="관공서"){ var ymakerimg = '<?php echo $board_skin_url ?>/img/icon01.png'; // 화살표 이미지 }else if(ca_name[i]=="기관"){ var ymakerimg = '<?php echo $board_skin_url ?>/img/icon19.png'; // 화살표 이미지 }else if(ca_name[i]=="병원"){ var ymakerimg = '<?php echo $board_skin_url ?>/img/icon02.png'; // 화살표 이미지 }else if(ca_name[i]=="기타"){ var ymakerimg = '<?php echo $board_skin_url ?>/img/icon03.png'; // 화살표 이미지 } ycmarkers.push(createMarker(latlng,content[i],ymakerimg)); } zoomChangeBoundsListener = google.maps.event.addListener(map, "bounds_changed",function(event){ if(this.getZoom() > 20) this.setZoom(16); google.maps.event.removeListener(zoomChangeBoundsListener); }); </script> <!--지도 끝 --> <!-- 게시판 검색 시작 { --> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <label for="sfl" class="sound_only">검색대상</label> <tr bgcolor="#262439"> <td style="padding:10px" width="60px"> <?php if ($is_category) { ?> <form name="fcategory" method="get"> <input type="hidden" name="bo_table" value="<?php echo $bo_table; ?>"> <select name="sca" onchange="this.form.submit();" style="padding:9px;border:0px"> <option value=''>지역선택</option> <?php echo get_category_option($bo_table, $sca); // SELECT OPTION 태그로 넘겨받음 ?> </select> </form> <?php } ?> </td> <form name="fsearch" method="get"> <input type="hidden" name="bo_table" value="<?php echo $bo_table ?>"> <input type="hidden" name="sca" value="<?php echo $sca ?>"> <input type="hidden" name="sop" value="and"> <td height="40px" style="padding:10px" width="130px"> <select name="sfl" id="sfl" style="padding:9px;border:0px"> <option value="wr_subject"<?php echo get_selected($sfl, 'wr_subject', true); ?>>매장명</option> <option value="wr_content"<?php echo get_selected($sfl, 'wr_content'); ?>>매장설명</option> <option value="wr_4"<?php echo get_selected($sfl, 'wr_4'); ?>>주소</option> <option value="wr_subject||wr_content"<?php echo get_selected($sfl, 'wr_subject||wr_content'); ?>>매장명+매장설명</option> <!-- <option value="mb_id,1"<?php echo get_selected($sfl, 'mb_id,1'); ?>>회원아이디</option> <option value="mb_id,0"<?php echo get_selected($sfl, 'mb_id,0'); ?>>회원아이디(코)</option> --> <option value="wr_name,1"<?php echo get_selected($sfl, 'wr_name,1'); ?>>글쓴이</option> <!-- <option value="wr_name,0"<?php echo get_selected($sfl, 'wr_name,0'); ?>>글쓴이(코)</option> --> </select> </td> <td> <label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label> <input type="text" name="stx" value="<?php echo stripslashes($stx) ?>" required id="stx" class="sch_input" size="25" maxlength="20" placeholder="검색어를 입력해주세요" style="width:100%;border:0px;padding:10px"> </td> <td width="95px" align="right" style="padding-right:15px"> <button type="submit" value="검색" class="sch_btn" style="padding:10px 20px;border:0px ">검색</button> </td> </form> </tr> </table> <!-- } 게시판 검색 끝 --> </br> <!-- 게시판 목록 시작 --> <div class="tbl_head01 tbl_wrap"> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr bgcolor="#f5f5f5" style="font-size:11pt;"> <th height="50px" width="10%" style="border-top:1px solid #ddd;border-bottom:1px solid #ddd">번호</th> <th width="20%" style="border-top:1px solid #ddd;border-bottom:1px solid #ddd">사진</th> <th width="30%" style="border-top:1px solid #ddd;border-bottom:1px solid #ddd">기관</th> <th width="50%" style="border-top:1px solid #ddd;border-bottom:1px solid #ddd">소개</th> </tr> <?php for ($i=0; $i<count($list); $i++) { if($i>0 && ($i % $bo_gallery_cols == 0)) $style = 'clear:both;'; else $style = ''; if ($i == 0) $k = 0; $k += 1; if ($k % $bo_gallery_cols == 0) $style .= "margin:0 !important;"; ?> <tr> <td align="center" style="border-bottom:1px solid #ddd"><?php if ($is_checkbox) { ?> <label for="chk_wr_id_<?php echo $i ?>" class="sound_only"><?php echo $list[$i]['subject'] ?></label> <input type="checkbox" name="chk_wr_id[]" value="<?php echo $list[$i]['wr_id'] ?>" id="chk_wr_id_<?php echo $i ?>" /> <?php } ?> <span class="sound_only"> </span> <?php if ($wr_id == $list[$i]['wr_id']) echo "<span class=\"bo_current\">열람중</span>"; else echo $list[$i]['num']; ?> </td> <td align="center" style="padding:10px;border-bottom:1px solid #ddd"><a href="<?php echo $list[$i]['href'] ?>"> <?php if ($list[$i]['is_notice']) { // 공지사항 ?> <strong style="width:<?php echo $board['bo_gallery_width'] ?>px;height:<?php echo $board['bo_gallery_height'] ?>px">공지</strong> <?php } else { $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']); if($thumb['src']) { $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'" id="mainImg'.$i.'" class=mine>'; } else { $img_content = '<span style="width:'.$board['bo_gallery_width'].'px;height:'.$board['bo_gallery_height'].'px"><img src="http://www.daiboo.co.kr/skin/board/k2webg/img/no_image.png"></span>'; } echo $img_content; } ?> </a> </td> <style> .subb { margin-left:5px !important;} #imgList{list-style:none; padding:0;*zoom:1; margin:0 auto 0 auto; position:absolute;cursor:pointer;} #imgList:after{content:""; display:block; clear:both;} #imgList li{ /*padding:0 10px;*/margin:0px;width:100%} #imgList li img{ width:90px;height:70px; margin:0 !important;border:1px solid #ddd;padding:10px} .mine{border:1px solid #ddd;padding:10px; width:90px;height:70px;} </style> <td style="border-bottom:1px solid #ddd;line-height:1.8em;text-align:left"><a href="<?php echo $list[$i]['href'] ?>" target="_blank" style="font-size:12pt;font-weight:bold;color:#155196;"> <?php echo $list[$i]['subject'] ?> <?php if ($list[$i]['comment_cnt']) { ?> <span class="sound_only">댓글</span><?php echo $list[$i]['comment_cnt']; ?><span class="sound_only">개</span> <?php } ?> </a> <?php // if ($list[$i]['link']['count']) { echo '['.$list[$i]['link']['count']}.']'; } // if ($list[$i]['file']['count']) { echo '<'.$list[$i]['file']['count'].'>'; } //if (isset($list[$i]['icon_new'])) echo $list[$i]['icon_new']; if (isset($list[$i]['icon_hot'])) echo $list[$i]['icon_hot']; //if (isset($list[$i]['icon_file'])) echo $list[$i]['icon_file']; //if (isset($list[$i]['icon_link'])) echo $list[$i]['icon_link']; //if (isset($list[$i]['icon_secret'])) echo $list[$i]['icon_secret']; ?> <br /> <span style="font-size:10pt;">·</span> <?php echo $list[$i]['wr_4']?><br /> <span style="font-size:10pt;">·</span> <?php echo $list[$i]['wr_5']?> </td> <td style="border-bottom:1px solid #ddd;font-size:10pt;"><?php echo $list[$i]['wr_6']?></td> </tr> <?php } ?> </table> </div> <!-- 게시판 목록 끝 --> <!-- 페이지 --> <?php echo $write_pages; ?> <!-- 하반 버튼 시작 --> <?php if ($list_href || $is_checkbox || $write_href) { ?> <div class="bo_fx"> <ul class="btn_bo_adm"> <?php if ($list_href) { ?> <li><a href="<?php echo $list_href ?>" class="btn_b01"> 목록</a></li> <?php } ?> <?php if ($is_checkbox) { ?> <li><input type="submit" name="btn_submit" value="선택삭제" onclick="document.pressed=this.value"></li> <li><input type="submit" name="btn_submit" value="선택복사" onclick="document.pressed=this.value"></li> <li><input type="submit" name="btn_submit" value="선택이동" onclick="document.pressed=this.value"></li> <?php } ?> </ul> <ul class="btn_bo_user"> <li><?php if ($write_href) { ?><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a><?php } ?></li> </ul> </div> <?php } ?> </form> </div> <?php if($is_checkbox) { ?> <noscript> <p>자바스크립트를 사용하지 않는 경우<br>별도의 확인 절차 없이 바로 선택삭제 처리하므로 주의하시기 바랍니다.</p> </noscript> <?php } ?> <!-- 하반 버튼 끝 --> <?php if ($is_checkbox) { ?> <script> function all_checked(sw) { var f = document.fboardlist; for (var i=0; i<f.length; i++) { if (f.elements[i].name == "chk_wr_id[]") f.elements[i].checked = sw; } } function fboardlist_submit(f) { var chk_count = 0; for (var i=0; i<f.length; i++) { if (f.elements[i].name == "chk_wr_id[]" && f.elements[i].checked) chk_count++; } if (!chk_count) { alert(document.pressed + "할 게시물을 하나 이상 선택하세요."); return false; } if(document.pressed == "선택복사") { select_copy("copy"); return; } if(document.pressed == "선택이동") { select_copy("move"); return; } if(document.pressed == "선택삭제") { if (!confirm("선택한 게시물을 정말 삭제하시겠습니까?\n\n한번 삭제한 자료는 복구할 수 없습니다\n\n답변글이 있는 게시글을 선택하신 경우\n답변글도 선택하셔야 게시글이 삭제됩니다.")) return false; f.removeAttribute("target"); f.action = "./board_list_update.php"; } return true; } // 선택한 게시물 복사 및 이동 function select_copy(sw) { var f = document.fboardlist; if (sw == 'copy') str = "복사"; else str = "이동"; var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1"); f.sw.value = sw; f.target = "move"; f.action = "./move.php"; f.submit(); } </script> <?php } ?> <!-- 게시판 목록 끝 -->
답변 1
undefined 할 게시물을 하나 이상 선택하세요.라고 떴다면 아래 구문에서 뜬 상황입니다.
if (!chk_count) {
alert(document.pressed + "할 게시물을 하나 이상 선택하세요.");
return false;
}
우선 chk_count 변수가 false 인 것 같구요,
그리고 undefined라고 뜨는 걸 봐서 document.pressed 변수가 정의되지 않은 것 같습니다.
이 부분을 살펴 보시면 될 것 같습니다.
답변을 작성하시기 전에 로그인 해주세요.