问大家一个问题,为什么子菜单不会出来
<html>
<head>
<title>菜单演示</title><style type="text/css">
<!--
body {font-size: 9pt;}
table {font-size: 9pt; background-color: #c0c0c0; color: #000000; cursor: default;}
td {font-size: 9pt;}
td.normal {border: 1 solid #c0c0c0;}
td.over {border-top: 1 solid #ffffff; border-left: 1 solid #ffffff; border-bottom: 1 solid #000000; border-right: 1 solid #000000;}
td.click {border-top: 1 solid #000000; border-left: 1 solid #000000; border-bottom: 1 solid #ffffff; border-right: 1 solid #ffffff;}
td.unselect {font-size: 9pt; color: #000000; background-color: #c0c0c0; cursor: default;}
td.select {font-size: 9pt; color: #ffffff; background-color: #000080; cursor: default;}
-->
</style>
<script language="JScript">
<!--
jsClick=0;
lastMainMenu=null;
lastSubMenu=null;
function M_OnMouseOver(id)
{
var MMenu;
var SMenu;
MMenu = eval("M_"+id);
SMenu = eval("S_"+id);
switch(jsClick)
{
case 0 :
MMenu.className="over";
break;
case 1 :
{
MMenu.className="click";
if(lastSubMenu && lastSubMenu != SMenu)
{
SMenu.style.display="block";
GoSelfPosition(MMenu,SMenu);
lastSubMenu.style.display="none";
lastSubMenu=SMenu;
}
break;
}
}
if(lastMainMenu && lastMainMenu != MMenu) lastMainMenu.className="normal";
lastMainMenu=MMenu;
}
function M_OnMouseOut(id)
{
var MMenu;
MMenu = eval("M_"+id);
switch(jsClick)
{
case 0 :
MMenu.className="normal";
break;
case 1 :
break;
}
}
function M_OnClick(id)
{
var MMenu;
var SMenu;
MMenu = eval("M_"+id);
SMenu = eval("S_"+id);
switch(jsClick)
{
case 0 : // 未选过菜单
MMenu.className="click";
jsClick=1;
SMenu.style.display="block";
GoSelfPosition(MMenu,SMenu);
lastMainMenu=MMenu;
lastSubMenu=SMenu;
break;
case 1 : // 取消选择状态
MMenu.className="over";
jsClick=0;
SMenu.style.display="none";
lastMainMenu=null;
lastSubMenu=null;
break;
}
}
function GoSelfPosition(MMenu,SMenu)
{
var w,h;
w=SMenu.offsetWidth; // 显示菜单的宽度
h=SMenu.offsetHeight; // 显示菜单的高度
SMenu.style.posLeft=document.body.scrollLeft+window.event.clientX-window.event.offsetX-4;
SMenu.style.posTop=document.body.scrollTop+window.event.clientY-window.event.offsetY+MMenu.offsetHeight-3;
if(SMenu.style.posLeft+w > document.body.scrollLeft+document.body.clientWidth)
SMenu.style.posLeft=document.body.scrollLeft+document.body.clientWidth-w;
if(SMenu.style.posTop+h > document.body.scrollTop+document.body.clientHeight)
SMenu.style.posTop=document.body.scrollTop+window.event.clientY-window.event.offsetY-h-4;
}
function S_OnMouseOver(id)
{
var SMenu;
SMenu = eval("I_"+id);
SMenu.className="select";
}
function S_OnMouseOut(id)
{
var SMenu;
SMenu = eval("I_"+id);
SMenu.className="unselect";
}
function S_OnClick(id,url)
{
var SMenu;
SMenu = eval("I_"+id);
SMenu.className="unselect";
jsClick=0;
lastMainMenu.className="normal";
lastSubMenu.style.display="none";
lastMainMenu=null;
lastSubMenu=null;
if(url == null)
eval("Do_"+id+"()");
else
alert("将连向:"+url);
}
function DocClick()
{
if(jsClick == 1)
{
jsClick=0;
lastMainMenu.className="normal";
lastSubMenu.style.display="none";
lastMainMenu=null;
lastSubMenu=null;
}
}
document.onclick=DocClick;
// 以下的函数为选择菜单后将执的函数
function Do_about()
{
alert("我是about()函数!");
}
function Do_helpfile()
{
alert("我是helpfile()函数!");
}
function Do_exit()
{
window.close();
}