한페이지 다중탭메뉴...2차 도움요청...ㅜㅜ 정보
한페이지 다중탭메뉴...2차 도움요청...ㅜㅜ본문
죄송합니다.....결국 소스를 통째로 올리네요...ㅠㅠ
앞전 질문에 답변 주신분께 감사드립니다. 그런데 아직 해결이 안되서요...
현재 메인페이지에..
<? include_once("include/tap_menu1.php"); // 탭메뉴?>
<? include_once("include/tap_menu2.php"); // 탭메뉴?>
형식으로 불러오고 있습니다.
tap_menu.php 의 내용도 모두 수정하여서..
이런식으로 여러개를 사용하려고 하는데..
제대로 적용이 안되네요...
※ 각각의 탭메뉴가 지정된 게시판을 불러오는건 잘 작동이 되는데...
※ 문제는...아래쪽 메뉴중 하나를 클릭하면 위쪽 탭메뉴가 움직이네요..ㅜㅜ
이런현상...ㅜㅜ
※ 염치불구하고 2번째 탭메뉴 소스 통으로 올립니다.ㅜㅜ
1번탭메뉴 소스와 다른점 : 1번탭메뉴는 1,2,3,4,5....2번탭메뉴는 6,7,8,9 와 게시판명 입니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once("./_common.php");
include_once("$g4[path]/lib/latest.lib.php");
//아래 부분 테이블명
$my_table6 = '11_1';
$my_table7 = '11_2';
$my_table8 = '11_3';
$my_table9 = '11_4';
// 게시판 이름 구하기
// 오누리 응용포함
$sql6 = "select bo_subject from $g4[board_table] where bo_table='$my_table6'";
$sql7 = "select bo_subject from $g4[board_table] where bo_table='$my_table7'";
$sql8 = "select bo_subject from $g4[board_table] where bo_table='$my_table8'";
$sql9 = "select bo_subject from $g4[board_table] where bo_table='$my_table9'";
$bo_name_sql6 = sql_query($sql6);
$bo_name6 = sql_fetch_array($bo_name_sql6);
$bo_name_sql7 = sql_query($sql7);
$bo_name7 = sql_fetch_array($bo_name_sql7);
$bo_name_sql8 = sql_query($sql8);
$bo_name8 = sql_fetch_array($bo_name_sql8);
$bo_name_sql9 = sql_query($sql9);
$bo_name9 = sql_fetch_array($bo_name_sql9);
$tap_width = "462"; // 텝 넓이
?>
<SCRIPT type="text/javascript">
<!--
old_debate='1';
function showLayer_tap(objid){
document.getElementById("debate"+old_debate).style.display="none";
document.getElementById("debate"+old_debate+"#1").style.display="";
document.getElementById("debate"+objid+"#1").style.display="none";
document.getElementById("debate"+objid).style.display="";
document.getElementById("debate_content"+old_debate).style.display="none";
document.getElementById("debate_content"+objid).style.display="";
old_debate=objid;
}
//-->
</SCRIPT>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">
<table width="<?=$tap_width?>" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="93">
<table cellSpacing=0 cellPadding=0 border=0>
<tr>
<td id=debate6><table cellSpacing=0 cellPadding=0 border=0 width=93 height=23 background="<?=$g4[path]?>/img/tap_img/nl_2.gif" style="cursor:pointer;" onclick=location.href="<?=$g4[path]?>/bbs/board.php?bo_table=<?=$my_table6?>"><tr><td align="center" width="91" class="small"><span style="color:#f0761c; font-weight:bold; vertical-align:-3px;"><?=$bo_name6[bo_subject]?></span></td><td width="2"></td></tr></table></TD>
<td id=debate6#1 style="DISPLAY: none;"><table cellSpacing=0 cellPadding=0 border=0 width=93 height=23 background="<?=$g4[path]?>/img/tap_img/nl.gif" style="cursor:pointer;" onclick=location.href="javascript:showLayer_tap('1')"><tr><td align="center" width="91" class="small"><span style="vertical-align:-3px;"><?=$bo_name6[bo_subject]?></span></td><td width="2"></td></tr></table></td>
</tr></table>
</td>
<td width="92">
<table cellSpacing=0 cellPadding=0 border=0>
<tr>
<td id=debate7 style="DISPLAY: none;"><table cellSpacing=0 cellPadding=0 border=0 width=92 height=23 background="<?=$g4[path]?>/img/tap_img/nm_2.gif" style="cursor:pointer;" onclick=location.href="<?=$g4[path]?>/bbs/board.php?bo_table=<?=$my_table7?>"><tr><td align="center" width="90" class="small"><span style="color:#f0761c; font-weight:bold; vertical-align:-3px;"><?=$bo_name7[bo_subject]?></span></td><td width="2"></td></tr></table></TD>
<td id=debate7#1><table cellSpacing=0 cellPadding=0 border=0 width=92 height=23 background="<?=$g4[path]?>/img/tap_img/nm.gif" style="cursor:pointer;" onclick=location.href="javascript:showLayer_tap('2')"><tr><td align="center" width="90" class="small"><span style="vertical-align:-3px;"><?=$bo_name7[bo_subject]?></span></td><td width="2"></td></tr></table></td>
</tr></table>
</td>
<td width="92">
<table cellSpacing=0 cellPadding=0 border=0>
<tr>
<td id=debate8 style="DISPLAY: none;"><table cellSpacing=0 cellPadding=0 border=0 width=92 height=23 background="<?=$g4[path]?>/img/tap_img/nm_2.gif" style="cursor:pointer;" onclick=location.href="<?=$g4[path]?>/bbs/board.php?bo_table=<?=$my_table8?>"><tr><td align="center" width="90" class="small"><span style="color:#f0761c; font-weight:bold; vertical-align:-3px;"><?=$bo_name8[bo_subject]?></span></td><td width="2"></td></tr></table></TD>
<td id=debate8#1><table cellSpacing=0 cellPadding=0 border=0 width=92 height=23 background="<?=$g4[path]?>/img/tap_img/nm.gif" style="cursor:pointer;" onclick=location.href="javascript:showLayer_tap('3')"><tr><td align="center" width="90" class="small"><span style="vertical-align:-3px;"><?=$bo_name8[bo_subject]?></span></td><td width="2"></td></tr></table></td>
</tr></table>
</td>
<td width="92">
<table cellSpacing=0 cellPadding=0 border=0>
<tr>
<td id=debate9 style="DISPLAY: none;"><table cellSpacing=0 cellPadding=0 border=0 width=92 height=23 background="<?=$g4[path]?>/img/tap_img/nm_2.gif" style="cursor:pointer;" onclick=location.href="<?=$g4[path]?>/bbs/board.php?bo_table=<?=$my_table9?>"><tr><td align="center" width="90" class="small"><span style="color:#f0761c; font-weight:bold; vertical-align:-3px;"><?=$bo_name9[bo_subject]?></span></td><td width="2"></td></tr></table></TD>
<td id=debate9#1><table cellSpacing=0 cellPadding=0 border=0 width=92 height=23 background="<?=$g4[path]?>/img/tap_img/nm.gif" style="cursor:pointer;" onclick=location.href="javascript:showLayer_tap('4')"><tr><td align="center" width="90" class="small"><span style="vertical-align:-3px;"><?=$bo_name9[bo_subject]?></span></td><td width="2"></td></tr></table></td>
</tr></table>
</td>
<td width="93">
<table cellSpacing=0 cellPadding=0 border=0>
<tr>
<td id=debate10 style="DISPLAY: none;"><table cellSpacing=0 cellPadding=0 border=0 width=93 height=23 background="<?=$g4[path]?>/img/tap_img/nr_2.gif" style="cursor:pointer;" onclick=location.href="<?=$g4[path]?>/bbs/group.php?gr_id=10"><tr><td align="center" width="91" class="small"><span style="color:#f0761c; font-weight:bold; vertical-align:-3px;"></span></td><td width="2"></td></tr></table></TD>
<td id=debate10#1><table cellSpacing=0 cellPadding=0 border=0 width=93 height=23 background="<?=$g4[path]?>/img/tap_img/nr.gif" style="cursor:pointer;" onclick=location.href="javascript:showLayer_tap('5')"><tr><td align="center" width="91" class="small"><span style="vertical-align:-3px;"></span></td><td width="2"></td></tr></table></td>
</tr></table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<table width="<?=$tap_width?>" height="50" border="0" cellspacing="0" cellpadding="0">
<colgroup width='1'>
<colgroup>
<colgroup width='1'>
<tr>
<td bgcolor="#d8d8d8"></td>
<td valign='top'>
<DIV id=debate_content6><?=latest('tab',$my_table6, "5", "42"); ?></div>
<DIV id=debate_content7 style="DISPLAY: none;"><?=latest('tab',$my_table7, "5", "42"); ?></div>
<DIV id=debate_content8 style="DISPLAY: none;"><?=latest('tab',$my_table8, "5", "42"); ?></div>
<DIV id=debate_content9 style="DISPLAY: none;"><?=latest('tab',$my_table9, "5", "42"); ?></div>
</td>
<td bgcolor="#d8d8d8"></td>
</tr>
<tr height='1'><td bgcolor="#d8d8d8"></td><td></td><td bgcolor="#d8d8d8"></td></tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<table width="<?=$tap_width?>" border="0" cellspacing="0" cellpadding="0">
<colgroup width='2'>
<colgroup>
<colgroup width='2'>
<tr height='3'>
<td><img src='<?=$g4[path]?>/img/tap_img/left_bottom.gif'></td>
<td width="100%" background='<?=$g4[path]?>/img/tap_img/center_bottom.gif'></td>
<td><img src='<?=$g4[path]?>/img/tap_img/right_bottom.gif'></td>
</tr>
</table>
</td>
</tr>
</table>
죄송합니다....ㅜㅜ
앞전 질문에 답변 주신분께 감사드립니다. 그런데 아직 해결이 안되서요...
현재 메인페이지에..
<? include_once("include/tap_menu1.php"); // 탭메뉴?>
<? include_once("include/tap_menu2.php"); // 탭메뉴?>
형식으로 불러오고 있습니다.
tap_menu.php 의 내용도 모두 수정하여서..
이런식으로 여러개를 사용하려고 하는데..
제대로 적용이 안되네요...
※ 각각의 탭메뉴가 지정된 게시판을 불러오는건 잘 작동이 되는데...
※ 문제는...아래쪽 메뉴중 하나를 클릭하면 위쪽 탭메뉴가 움직이네요..ㅜㅜ
이런현상...ㅜㅜ
※ 염치불구하고 2번째 탭메뉴 소스 통으로 올립니다.ㅜㅜ
1번탭메뉴 소스와 다른점 : 1번탭메뉴는 1,2,3,4,5....2번탭메뉴는 6,7,8,9 와 게시판명 입니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once("./_common.php");
include_once("$g4[path]/lib/latest.lib.php");
//아래 부분 테이블명
$my_table6 = '11_1';
$my_table7 = '11_2';
$my_table8 = '11_3';
$my_table9 = '11_4';
// 게시판 이름 구하기
// 오누리 응용포함
$sql6 = "select bo_subject from $g4[board_table] where bo_table='$my_table6'";
$sql7 = "select bo_subject from $g4[board_table] where bo_table='$my_table7'";
$sql8 = "select bo_subject from $g4[board_table] where bo_table='$my_table8'";
$sql9 = "select bo_subject from $g4[board_table] where bo_table='$my_table9'";
$bo_name_sql6 = sql_query($sql6);
$bo_name6 = sql_fetch_array($bo_name_sql6);
$bo_name_sql7 = sql_query($sql7);
$bo_name7 = sql_fetch_array($bo_name_sql7);
$bo_name_sql8 = sql_query($sql8);
$bo_name8 = sql_fetch_array($bo_name_sql8);
$bo_name_sql9 = sql_query($sql9);
$bo_name9 = sql_fetch_array($bo_name_sql9);
$tap_width = "462"; // 텝 넓이
?>
<SCRIPT type="text/javascript">
<!--
old_debate='1';
function showLayer_tap(objid){
document.getElementById("debate"+old_debate).style.display="none";
document.getElementById("debate"+old_debate+"#1").style.display="";
document.getElementById("debate"+objid+"#1").style.display="none";
document.getElementById("debate"+objid).style.display="";
document.getElementById("debate_content"+old_debate).style.display="none";
document.getElementById("debate_content"+objid).style.display="";
old_debate=objid;
}
//-->
</SCRIPT>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">
<table width="<?=$tap_width?>" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="93">
<table cellSpacing=0 cellPadding=0 border=0>
<tr>
<td id=debate6><table cellSpacing=0 cellPadding=0 border=0 width=93 height=23 background="<?=$g4[path]?>/img/tap_img/nl_2.gif" style="cursor:pointer;" onclick=location.href="<?=$g4[path]?>/bbs/board.php?bo_table=<?=$my_table6?>"><tr><td align="center" width="91" class="small"><span style="color:#f0761c; font-weight:bold; vertical-align:-3px;"><?=$bo_name6[bo_subject]?></span></td><td width="2"></td></tr></table></TD>
<td id=debate6#1 style="DISPLAY: none;"><table cellSpacing=0 cellPadding=0 border=0 width=93 height=23 background="<?=$g4[path]?>/img/tap_img/nl.gif" style="cursor:pointer;" onclick=location.href="javascript:showLayer_tap('1')"><tr><td align="center" width="91" class="small"><span style="vertical-align:-3px;"><?=$bo_name6[bo_subject]?></span></td><td width="2"></td></tr></table></td>
</tr></table>
</td>
<td width="92">
<table cellSpacing=0 cellPadding=0 border=0>
<tr>
<td id=debate7 style="DISPLAY: none;"><table cellSpacing=0 cellPadding=0 border=0 width=92 height=23 background="<?=$g4[path]?>/img/tap_img/nm_2.gif" style="cursor:pointer;" onclick=location.href="<?=$g4[path]?>/bbs/board.php?bo_table=<?=$my_table7?>"><tr><td align="center" width="90" class="small"><span style="color:#f0761c; font-weight:bold; vertical-align:-3px;"><?=$bo_name7[bo_subject]?></span></td><td width="2"></td></tr></table></TD>
<td id=debate7#1><table cellSpacing=0 cellPadding=0 border=0 width=92 height=23 background="<?=$g4[path]?>/img/tap_img/nm.gif" style="cursor:pointer;" onclick=location.href="javascript:showLayer_tap('2')"><tr><td align="center" width="90" class="small"><span style="vertical-align:-3px;"><?=$bo_name7[bo_subject]?></span></td><td width="2"></td></tr></table></td>
</tr></table>
</td>
<td width="92">
<table cellSpacing=0 cellPadding=0 border=0>
<tr>
<td id=debate8 style="DISPLAY: none;"><table cellSpacing=0 cellPadding=0 border=0 width=92 height=23 background="<?=$g4[path]?>/img/tap_img/nm_2.gif" style="cursor:pointer;" onclick=location.href="<?=$g4[path]?>/bbs/board.php?bo_table=<?=$my_table8?>"><tr><td align="center" width="90" class="small"><span style="color:#f0761c; font-weight:bold; vertical-align:-3px;"><?=$bo_name8[bo_subject]?></span></td><td width="2"></td></tr></table></TD>
<td id=debate8#1><table cellSpacing=0 cellPadding=0 border=0 width=92 height=23 background="<?=$g4[path]?>/img/tap_img/nm.gif" style="cursor:pointer;" onclick=location.href="javascript:showLayer_tap('3')"><tr><td align="center" width="90" class="small"><span style="vertical-align:-3px;"><?=$bo_name8[bo_subject]?></span></td><td width="2"></td></tr></table></td>
</tr></table>
</td>
<td width="92">
<table cellSpacing=0 cellPadding=0 border=0>
<tr>
<td id=debate9 style="DISPLAY: none;"><table cellSpacing=0 cellPadding=0 border=0 width=92 height=23 background="<?=$g4[path]?>/img/tap_img/nm_2.gif" style="cursor:pointer;" onclick=location.href="<?=$g4[path]?>/bbs/board.php?bo_table=<?=$my_table9?>"><tr><td align="center" width="90" class="small"><span style="color:#f0761c; font-weight:bold; vertical-align:-3px;"><?=$bo_name9[bo_subject]?></span></td><td width="2"></td></tr></table></TD>
<td id=debate9#1><table cellSpacing=0 cellPadding=0 border=0 width=92 height=23 background="<?=$g4[path]?>/img/tap_img/nm.gif" style="cursor:pointer;" onclick=location.href="javascript:showLayer_tap('4')"><tr><td align="center" width="90" class="small"><span style="vertical-align:-3px;"><?=$bo_name9[bo_subject]?></span></td><td width="2"></td></tr></table></td>
</tr></table>
</td>
<td width="93">
<table cellSpacing=0 cellPadding=0 border=0>
<tr>
<td id=debate10 style="DISPLAY: none;"><table cellSpacing=0 cellPadding=0 border=0 width=93 height=23 background="<?=$g4[path]?>/img/tap_img/nr_2.gif" style="cursor:pointer;" onclick=location.href="<?=$g4[path]?>/bbs/group.php?gr_id=10"><tr><td align="center" width="91" class="small"><span style="color:#f0761c; font-weight:bold; vertical-align:-3px;"></span></td><td width="2"></td></tr></table></TD>
<td id=debate10#1><table cellSpacing=0 cellPadding=0 border=0 width=93 height=23 background="<?=$g4[path]?>/img/tap_img/nr.gif" style="cursor:pointer;" onclick=location.href="javascript:showLayer_tap('5')"><tr><td align="center" width="91" class="small"><span style="vertical-align:-3px;"></span></td><td width="2"></td></tr></table></td>
</tr></table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<table width="<?=$tap_width?>" height="50" border="0" cellspacing="0" cellpadding="0">
<colgroup width='1'>
<colgroup>
<colgroup width='1'>
<tr>
<td bgcolor="#d8d8d8"></td>
<td valign='top'>
<DIV id=debate_content6><?=latest('tab',$my_table6, "5", "42"); ?></div>
<DIV id=debate_content7 style="DISPLAY: none;"><?=latest('tab',$my_table7, "5", "42"); ?></div>
<DIV id=debate_content8 style="DISPLAY: none;"><?=latest('tab',$my_table8, "5", "42"); ?></div>
<DIV id=debate_content9 style="DISPLAY: none;"><?=latest('tab',$my_table9, "5", "42"); ?></div>
</td>
<td bgcolor="#d8d8d8"></td>
</tr>
<tr height='1'><td bgcolor="#d8d8d8"></td><td></td><td bgcolor="#d8d8d8"></td></tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<table width="<?=$tap_width?>" border="0" cellspacing="0" cellpadding="0">
<colgroup width='2'>
<colgroup>
<colgroup width='2'>
<tr height='3'>
<td><img src='<?=$g4[path]?>/img/tap_img/left_bottom.gif'></td>
<td width="100%" background='<?=$g4[path]?>/img/tap_img/center_bottom.gif'></td>
<td><img src='<?=$g4[path]?>/img/tap_img/right_bottom.gif'></td>
</tr>
</table>
</td>
</tr>
</table>
죄송합니다....ㅜㅜ
댓글 전체
getElementById 로 지정한 ID 값이 중복되기 때문 입니다.
아원님 답변 감사드립니다..그러면 이렇게 수정하면 되는건가요?
debate 를 debate1 으로 바꾸는 식으로 하면 되나요?
<SCRIPT type="text/javascript">
<!--
old_debate='1';
function showLayer_tap(objid){
document.getElementById("debate1"+old_debate).style.display="none";
document.getElementById("debate1"+old_debate+"#1").style.display="";
document.getElementById("debate1"+objid+"#1").style.display="none";
document.getElementById("debate1"+objid).style.display="";
document.getElementById("debate1_content"+old_debate).style.display="none";
document.getElementById("debate1_content"+objid).style.display="";
old_debate=objid;
}
//-->
</SCRIPT>
debate 를 debate1 으로 바꾸는 식으로 하면 되나요?
<SCRIPT type="text/javascript">
<!--
old_debate='1';
function showLayer_tap(objid){
document.getElementById("debate1"+old_debate).style.display="none";
document.getElementById("debate1"+old_debate+"#1").style.display="";
document.getElementById("debate1"+objid+"#1").style.display="none";
document.getElementById("debate1"+objid).style.display="";
document.getElementById("debate1_content"+old_debate).style.display="none";
document.getElementById("debate1_content"+objid).style.display="";
old_debate=objid;
}
//-->
</SCRIPT>
스크립트 뿐만 아니라 해당 id 도 바꿔줘야 합니다.
아래는 하나의 예제 입니다.
<script type="text/javascript">
function Layer(key)
{
if (key == '1') {
document.getElementById("DIV1").style.display = "inline";
document.getElementById("DIV2").style.display = "none";
}
else if (key == '2') {
document.getElementById("DIV1").style.display = "none";
document.getElementById("DIV2").style.display = "inline";
}
}
</script>
<a href="javascript:;" onclick="Layer('1');">111</a>
<a href="javascript:;" onclick="Layer('2');">222</a>
<p>
<div id="DIV1" style="display:inline;">AA</div>
<div id="DIV2" style="display:none;">BB</div>
아래는 하나의 예제 입니다.
<script type="text/javascript">
function Layer(key)
{
if (key == '1') {
document.getElementById("DIV1").style.display = "inline";
document.getElementById("DIV2").style.display = "none";
}
else if (key == '2') {
document.getElementById("DIV1").style.display = "none";
document.getElementById("DIV2").style.display = "inline";
}
}
</script>
<a href="javascript:;" onclick="Layer('1');">111</a>
<a href="javascript:;" onclick="Layer('2');">222</a>
<p>
<div id="DIV1" style="display:inline;">AA</div>
<div id="DIV2" style="display:none;">BB</div>
위 내용을 이해하신다면 쉽게 탭메뉴 스킨을 만드실 수 있을거라 생각되네요. ^^
답변 주셔서 감사합니다. 탭메뉴...어렵네요..^^;;