묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
자바 계단형 메뉴 질문입니다...
2003.09.11 11:42
밑에 소스는 여기 엔지오 강좌 게시판에 있는것을 조금 고친건데요...
메뉴에 마우스를 올리면 하위 메뉴가 나오는데 마우스를 밖으로 빼도 하위 메뉴가 계속 그대로 있어서 문제입니다...
마우스를 빼면 하위메뉴가 안나오도록 고쳐서 주시면 정말 감사하겠습니다...
자바스크립트를 전혀 몰라서여...;;;
부탁드립니다...
--------------------------------------------------------------------------------------------------
<head>
<title>Menu Test</title>
<style type="text/css">
a { font-size:10pt; font-family:tahoma; color: navy; text-decoration: none }
a:hover { color: red; font-family:tahoma; text-decoration: underline }
a.plain:hover { font-size:10pt; font-family:tahoma; color: blue; text-decoration: underline }
#box {
position:absolute;
visibility:hidden;
layer-background-color:silver }
#limebox {background-color:#eeeeee }
#bluebox {background-color:#eeeeee }
#mnubar {font:10pt; arial; font-weight:normal }
</style>
<script language="JavaScript">
ns=window.navigator.appName == "Netscape"
ie=window.navigator.appName == "Microsoft Internet Explorer"
function openIt(x) {
<!--♣넷스케이프의경우-->
if(ns) {
showbox= document.layers[x+1]
showbox.visibility = "show";
showbox.left=90;
var items = 5 ; // 메뉴의 갯수
for (i=1; i<=items; i++) {
elopen=document.layers[i]
if (i != (x + 1)) {
elopen.visibility = "hide" }
}
}
<!--♣익스플로러의 경우-->
if(ie) {
curEl = event.toElement
curEl.style.background = "#eeeeee" // 마우스 오버시 배경색
showBox = document.all.box[x];
showBox.style.visibility = "visible";
showBox.style.left = 90; // 서브메뉴의 왼쪽여백
var items = 5 // 메뉴의 갯수
for (i=0; i<items; i++) {
elOpen=document.all.box[i]
barEl=document.all.mnubar[i]
if (i != x){
elOpen.style.visibility = "hidden"
barEl.style.background = "white" // 비활성메뉴 배경색
}
}
}
}
function closeIt() {
var items = 5 // 메뉴의 갯수
for (i=0; i<items; i++) {
if(ie){
document.all.box[i].style.visibility = "hidden"
barEl=document.all.mnubar[i]
barEl.style.background = "white"
}
if(ns){ document.layers[i+1].visibility = "hide"}
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr"></head>
<body>
<table width="100" border="0" cellspacing="0" cellpadding="6">
<tr>
<td> </td>
<td> <a href="#" onmouseover="openIt(0)" id=mnubar>Menu 1</a><br></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> <a href="#" onmouseover="openIt(1)" id=mnubar>Menu 2</a><br></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> <a href="#" onmouseover="openIt(2)" id=mnubar>Menu 3</a><br></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> <a href="#" onmouseover="openIt(3)" id=mnubar>Menu 4</a><br></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> <a href="#" onmouseover="openIt(4)" id=mnubar>Menu 5</a><br></td>
<td> </td>
</tr>
</table>
<br>
<!-- ♣서브메뉴 1 -->
<div id=box style=top:25>
<table width="100" border="0" cellspacing="0" cellpadding="0" id=bluebox>
<tr>
<td><a href='#'>SUB-1-1</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
</table>
</div>
<!-- ♣서브메뉴 2 -->
<div id=box style=top:55>
<table width="100" border="0" cellspacing="0" cellpadding="0" id=bluebox>
<tr>
<td><a href='#'>SUB-1-1</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
</table>
</div>
<!-- ♣서브메뉴 3 -->
<div id=box style=top:85>
<table width="100" border="0" cellspacing="0" cellpadding="0" id=bluebox>
<tr>
<td><a href='#'+ '+ '>SUB-1-1</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
</table>
</div>
<!-- ♣서브메뉴 4 -->
<div id=box style=top:115>
<table width="100" border="0" cellspacing="0" cellpadding="0" id=bluebox>
<tr>
<td><a href='#'>SUB-1-1</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
</table>
</div>
<!-- ♣서브메뉴 5 -->
<div id=box style=top:145>
<table width="100" border="0" cellspacing="0" cellpadding="0" id=bluebox>
<tr>
<td><a href='#'>SUB-1-1</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
</table>
</div>
</body>
메뉴에 마우스를 올리면 하위 메뉴가 나오는데 마우스를 밖으로 빼도 하위 메뉴가 계속 그대로 있어서 문제입니다...
마우스를 빼면 하위메뉴가 안나오도록 고쳐서 주시면 정말 감사하겠습니다...
자바스크립트를 전혀 몰라서여...;;;
부탁드립니다...
--------------------------------------------------------------------------------------------------
<head>
<title>Menu Test</title>
<style type="text/css">
a { font-size:10pt; font-family:tahoma; color: navy; text-decoration: none }
a:hover { color: red; font-family:tahoma; text-decoration: underline }
a.plain:hover { font-size:10pt; font-family:tahoma; color: blue; text-decoration: underline }
#box {
position:absolute;
visibility:hidden;
layer-background-color:silver }
#limebox {background-color:#eeeeee }
#bluebox {background-color:#eeeeee }
#mnubar {font:10pt; arial; font-weight:normal }
</style>
<script language="JavaScript">
ns=window.navigator.appName == "Netscape"
ie=window.navigator.appName == "Microsoft Internet Explorer"
function openIt(x) {
<!--♣넷스케이프의경우-->
if(ns) {
showbox= document.layers[x+1]
showbox.visibility = "show";
showbox.left=90;
var items = 5 ; // 메뉴의 갯수
for (i=1; i<=items; i++) {
elopen=document.layers[i]
if (i != (x + 1)) {
elopen.visibility = "hide" }
}
}
<!--♣익스플로러의 경우-->
if(ie) {
curEl = event.toElement
curEl.style.background = "#eeeeee" // 마우스 오버시 배경색
showBox = document.all.box[x];
showBox.style.visibility = "visible";
showBox.style.left = 90; // 서브메뉴의 왼쪽여백
var items = 5 // 메뉴의 갯수
for (i=0; i<items; i++) {
elOpen=document.all.box[i]
barEl=document.all.mnubar[i]
if (i != x){
elOpen.style.visibility = "hidden"
barEl.style.background = "white" // 비활성메뉴 배경색
}
}
}
}
function closeIt() {
var items = 5 // 메뉴의 갯수
for (i=0; i<items; i++) {
if(ie){
document.all.box[i].style.visibility = "hidden"
barEl=document.all.mnubar[i]
barEl.style.background = "white"
}
if(ns){ document.layers[i+1].visibility = "hide"}
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr"></head>
<body>
<table width="100" border="0" cellspacing="0" cellpadding="6">
<tr>
<td> </td>
<td> <a href="#" onmouseover="openIt(0)" id=mnubar>Menu 1</a><br></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> <a href="#" onmouseover="openIt(1)" id=mnubar>Menu 2</a><br></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> <a href="#" onmouseover="openIt(2)" id=mnubar>Menu 3</a><br></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> <a href="#" onmouseover="openIt(3)" id=mnubar>Menu 4</a><br></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> <a href="#" onmouseover="openIt(4)" id=mnubar>Menu 5</a><br></td>
<td> </td>
</tr>
</table>
<br>
<!-- ♣서브메뉴 1 -->
<div id=box style=top:25>
<table width="100" border="0" cellspacing="0" cellpadding="0" id=bluebox>
<tr>
<td><a href='#'>SUB-1-1</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
</table>
</div>
<!-- ♣서브메뉴 2 -->
<div id=box style=top:55>
<table width="100" border="0" cellspacing="0" cellpadding="0" id=bluebox>
<tr>
<td><a href='#'>SUB-1-1</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
</table>
</div>
<!-- ♣서브메뉴 3 -->
<div id=box style=top:85>
<table width="100" border="0" cellspacing="0" cellpadding="0" id=bluebox>
<tr>
<td><a href='#'+ '+ '>SUB-1-1</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
</table>
</div>
<!-- ♣서브메뉴 4 -->
<div id=box style=top:115>
<table width="100" border="0" cellspacing="0" cellpadding="0" id=bluebox>
<tr>
<td><a href='#'>SUB-1-1</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
</table>
</div>
<!-- ♣서브메뉴 5 -->
<div id=box style=top:145>
<table width="100" border="0" cellspacing="0" cellpadding="0" id=bluebox>
<tr>
<td><a href='#'>SUB-1-1</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
<tr>
<td><a href=#>SUB-1-2</a></td>
</tr>
</table>
</div>
</body>