자바질문입니다!
본문
http://kimcare07.cafe24.com/shopinfo/asktax.html
여기가 제가 만든 페이지인데요
세금계산서 버튼을 누르고 나서 마우스를 다른곳으로 치우면
하단의 설명페이지가 지워집니다.
마우스가 어디에 있든 설명페이지가 고정되었으면 좋겠습니다.
-------------------------------------------------------------------------------------------------------
var old_viewid = 0;
function menu_view(viewid){
if(viewid!=old_viewid){
document.getElementById("submenu"+viewid).style.display="block";
if(old_viewid!="0")document.getElementById("submenu"+old_viewid).style.display="none";
old_viewid = viewid;
}
}
function menu_hide(hideid){
document.getElementById("submenu"+hideid).style.display="none";
old_viewid = 0;
}
window.onload = function()
{ menu_view(1);}
</script>
</head>
<style>
<div id="buttonn01">
<ul>
<li onmouseover="javascript:menu_view(1);" onmouseout="javascript:menu_hide(1);">
<a href='#' id="button" class='button1'>세금계산서출력안내</a>
<ul id="submenu1" class="submenu1" onmouseover="javascript:menu_view(2);" onmouseout="javascript:menu_hide(1);">
<li class="submenu"><a href="#"><img src="/SkinImg/asktax/01.jpg" alt="세금계산서출력안내"></a></li>
</ul>
</li>
<li onmouseover="javascript:menu_view(2);" onmouseout="javascript:menu_hide(2);">
<a href='#' id="button" class='button2'>현금영수증출력안내</a>
<ul id="submenu2" class="submenu2" onmouseout="javascript:menu_hide(2);">
<li class="submenu"><a href="#"><img src="/SkinImg/asktax/02.jpg" alt="현금영수증출력안내"></a></li>
</ul>
</li>
<li onmouseover="javascript:menu_view(3);" onmouseout="javascript:menu_hide(3);">
<a href='#' id="button" class='button3'>견적서출력안내</a>
<ul id="submenu3" class="submenu3" onmouseout="javascript:menu_hide(3);">
<li class="submenu"><a href="#"><img src="/SkinImg/asktax/03.jpg" alt="견적서출력안내"></a></li>
</ul>
</li>
<li onmouseover="javascript:menu_view(4);" onmouseout="javascript:menu_hide(4);">
<a href='#' id="button" class='button4'>카드전표출력안내</a>
<ul id="submenu4" class="submenu4" onmouseout="javascript:menu_hide(4);">
<li class="submenu"><a href="#"><img src="/SkinImg/asktax/04.jpg" alt="카드전표출력안내"></a></li>
</ul>
</li>
<li onmouseover="javascript:menu_view(5);" onmouseout="javascript:menu_hide(5);">
<a href='#' id="button" class='button5'>거래명세서출력안내</a>
<ul id="submenu5" class="submenu5" onmouseout="javascript:menu_hide(5);">
<li class="submenu"><a href="#"><img src="/SkinImg/asktax/05.jpg" alt="거래명세서출력안내"></a></li>
</ul>
</li>
</ul>
</div>
답변 1
function menu_view(viewid){
if(viewid!=old_viewid){document.getElementById("submenu"+viewid).style.display="block";
if(old_viewid!="0")document.getElementById("submenu"+old_viewid).style.display="block";
old_viewid = viewid;
}
테스트는 안해 봤음...