고수님들 부탁드립니다 채택완료
그누보드4 팝업 사용하고 있는 소스주소입니다
https://sir.kr/g4_plugin/12693?sfl=wr_subject&stx=%ED%8C%9D%EC%97%85" rel="nofollow noreferrer noopener" target="_blank">https://sir.kr/g4_plugin/12693?sfl=wr_subject&stx=%ED%8C%9D%EC%97%85
선택수정버튼과 선택삭제버튼이 먹통입니다
다음 소스중 어디를 수정해야 할까요?
-------------------------------------------------------------------------------------------------------------------
<?
$sub_menu = "300600";
include_once("./_common.php");
auth_check($auth[$sub_menu], "r");
if ($is_admin != "super")
alert("최고관리자만 접근 가능합니다.");
$g4['title'] = "레이어팝업 관리";
include_once ("./admin.head.php");
if ($w == "선택수정")
{
for($i=0;$i<count($chk);$i++){
$sql = " update $g4[layer_popup_table] set lp_type = '{$lp_type[$chk[$i]]}', lp_use = '{$lp_use[$chk[$i]]}' where lp_id = {$lp_id[$chk[$i]]} ";
sql_query($sql);
}
}
else if ($w == "선택삭제")
{
for($i=0;$i<count($chk);$i++){
$sql = " delete from $g4[layer_popup_table] where lp_id = {$lp_id[$chk[$i]]} ";
//die($sql);
sql_query($sql);
}
}
$colspan=9;
$sql = "select * from $g4[layer_popup_table] order by lp_id desc ";
$result = sql_query($sql, false);
// 테이블이 없다면 생성합니다.
if (!$result)
{
sql_query(" CREATE TABLE IF NOT EXISTS `$g4[layer_popup_table]` (
`lp_id` int(11) NOT NULL auto_increment,
`lp_type` varchar(255) NOT NULL,
`lp_gigan` tinyint(4) NOT NULL,
`lp_begin_datetime` datetime NOT NULL,
`lp_end_datetime` datetime NOT NULL,
`lp_subject` varchar(255) NOT NULL,
`lp_left` int(11) NOT NULL,
`lp_top` int(11) NOT NULL,
`lp_width` int(11) NOT NULL,
`lp_height` int(11) NOT NULL,
`lp_center` tinyint(4) NOT NULL,
`lp_menubar` tinyint(4) NOT NULL,
`lp_toolbar` tinyint(4) NOT NULL,
`lp_resizable` tinyint(4) NOT NULL,
`lp_scrollbars` tinyint(4) NOT NULL,
`lp_status` tinyint(4) NOT NULL,
`lp_content` text NOT NULL,
`lp_use` tinyint(4) NOT NULL,
PRIMARY KEY (`lp_id`)
) ");
}
$total_count = https://sir.kr/main/member/?mb_id=goodchurch" target="_blank">@mysql_num_rows($result);
$rows = $config[cf_page_rows];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql="select * from $g4[layer_popup_table] order by lp_id desc limit $from_record, $rows ";
$result = sql_query($sql);
?>
<style>
form { margin:0px; padding:0px; }
.datetime { font:11px tahoma; }
</style>
<form id=fsearch>
<input type=hidden name=page value="<?=$page?>">
<table width=100% cellpadding=4 cellspacing=0>
<tr>
<td width=20%><a href="<?=$_SERVER[PHP_SELF]?>">처음</a></td>
<td width=60% align=center>
</td>
<td width=20% align=right>건수 : <? echo $total_count ?> </td>
</tr>
</table>
</form>
<table width=100% cellpadding=0 cellspacing=1>
<form id=flist method=post action="<?=$_SERVER[PHP_SELF]?>">
<input type=hidden name=page value="<?=$page?>">
<input type=hidden name=w value="">
<colgroup width=30>
<colgroup width=>
<colgroup width=60>
<colgroup width=60>
<colgroup width=60>
<colgroup width=60>
<colgroup width=70>
<colgroup width=40>
<colgroup width=30>
<tr><td colspan='<?=$colspan?>' class='line1'></td></tr>
<tr class='bgcol1 bold col1 ht center'>
<td><input type="checkbox" id="allchk"></td>
<td>제목</td>
<td>타입</td>
<td>사이즈</td>
<td>기간</td>
<td>시작날짜</td>
<td>마지막날짜</td>
<td>사용</td>
<td><a href="./layer_form.php"><img src='<?=$g4[admin_path]?>/img/icon_insert.gif' border=0 title='팝업생성'></a></td>
</tr>
<?
for($i=0;$row=sql_fetch_array($result);$i++)
{
$subject = stripslashes($row[lp_subject]);
$gigan = $row[lp_gigan]."일";
?>
<tr class='list$list col2 ht center'>
<td>
<input type=checkbox name="chk[]" value="<?=$i?>">
<input type=hidden name='lp_id[]' value='<?=$row[lp_id]?>'>
</td>
<td align=left><?=$subject?></td>
<td>
<select name="lp_type[]" id="lp_type_<?=$i?>">
<option value="레이어">레이어</option>
<option value="팝업창">팝업창</option>
</select>
<script>document.getElementById("lp_type_<?=$i?>").value = "<?=$row[lp_type]?>";</script>
</td>
<td><?=$row[lp_width]?>x<?=$row[lp_height]?></td>
<td><?=$gigan?></td>
<td class=datetime><?=substr($row[lp_begin_datetime],2,11)?></td>
<td class=datetime><?=substr($row[lp_end_datetime],2,11)?></td>
<td>
<select name="lp_use[]" id="lp_use_<?=$i?>">
<option value="1">사용</option>
<option value="0">일시중지</option>
</select>
<script>document.getElementById("lp_use_<?=$i?>").value = "<?=$row[lp_use]?>";</script>
</td>
<td align=center>
<a href="./layer_form.php?w=u&lp_id=<?=$row[lp_id]?>"><img src='img/icon_modify.gif' border=0 title='수정'></a>
</td>
</tr>
<tr><td colspan='<?=$colspan?>' class='line2'></td></tr>
<?}?>
<?if(!$total_count){?>
<tr><td colspan='<?=$colspan?>' align=center height=100 bgcolor=#ffffff>팝업이 생성되지 않았습니다.</td></tr>
<tr><td colspan='<?=$colspan?>' class='line2'></td></tr>
<?}?>
</table>
<table width=100% cellpadding=3 cellspacing=1>
<tr><td width=70%>
<input type=button class="btn1" id="chkupd" value="선택수정">
<input type=button class="btn1" id="chkdel" value="선택삭제">
</td>
<td width=30% align=right><?=get_paging($config[cf_write_pages], $page, $total_page, "$_SERVER[PHP_SELF]?$qstr&page=")?></td>
</tr></table>
</form>
<script type="text/javascript">
$(function() {
$("#allchk").bind("click", function() {
$("[name=chk\[\]]").attr("checked", this.checked);
});
$("#chkupd,#chkdel").bind("click", function() {
if (!$("[name=chk\[\]]:checked").length)
{
alert(this.value+"하실 항목을 선택하세요.");
return;
}
// 선택삭제의 경우에만 물어봄
if (this.id == "chkdel" && !confirm(this.value+" 후에는 복구가 불가합니다.\n\n정말 실행하시겠습니까?"))
return;
$("#flist [name=w]").val(this.value);
$("#flist").submit();
});
});
</script>
<?
include_once("./admin.tail.php");
?>
-------------------------------------------------------------------------------------------------------------
리스트에서 수정 안되는 현상 수정
$("#flist [name=w]").val(this.value);
에서
$("input[name=w]").val(this.value);
로 수정
사유. name=w 값에 벨류값이 정상적으로 지급 안됨
해결
다이렉트로 input의 name이 w인것을 찾아 지정한다.
-------------------------------------------------------------------------------------------------------------
윗글 처럼 하라는데 수정해도 선택수정버튼과 선택삭제버튼이 그대로 먹통입니다
답변 2개
스크립트로 동작하는 버튼이 먹통이라면 분명 오류메세지를 확인할수 있을겁니다.
크롬의 개발자도구를 통해 해당 페이지를 새로고침하시고
원하시는 동작을 일으켰을때 콘솔상의 오류메세지를 확인하시면 오류 원인을 확인할 수 있습니다.
아니면, 사이트 주소를 올려주시면 도움받기 편하실거에요.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
그누4 구형 jquery 에 맞춰진 부분이 깨지는것같은데
신텍스에러가 났으니 이후 스크립트가 동작되지 않는것같아보여요.
오류나는 name=chk[] 셀렉터를 아래처럼 변경해보세요.
$("input[name^='chk['][name$=']']")
.attr("checked",this.checked) 이부분도 동작안될거같은데
.prop("checked", true);
이렇게 바꿔보시구요.