那位大虾能帮我解释一下这一段代码? Javascript
<SCRIPTlanguage="javascript">variShowMenu=-1;functionshowsubmenu(sid){whichEl=eval("s...
<SCRIPT language="javascript">
var iShowMenu = -1;
function showsubmenu(sid)
{
whichEl = eval("submenu" + sid);
if (whichEl.style.display == "none")
{
if (iShowMenu != -1)
{
eval("submenu" + iShowMenu + ".style.display=\"none\";");
}
eval("submenu" + sid + ".style.display=\"\";");
iShowMenu = sid;
}
else
{
eval("submenu" + sid + ".style.display=\"none\";");
iShowMenu = -1;
}
}
</script> 展开
var iShowMenu = -1;
function showsubmenu(sid)
{
whichEl = eval("submenu" + sid);
if (whichEl.style.display == "none")
{
if (iShowMenu != -1)
{
eval("submenu" + iShowMenu + ".style.display=\"none\";");
}
eval("submenu" + sid + ".style.display=\"\";");
iShowMenu = sid;
}
else
{
eval("submenu" + sid + ".style.display=\"none\";");
iShowMenu = -1;
}
}
</script> 展开
2个回答
展开全部
//菜单显示
var iShowMenu = -1;
function showsubmenu(sid)
{
whichEl = eval("submenu" + sid); //拼接你所点击的目录ID
if (whichEl.style.display == "none"){ //如果当前目录没被显示
if (iShowMenu != -1){ //如果有下级菜单
eval("submenu" + iShowMenu + ".style.display=\"none\";"); //下级菜单隐藏
}
eval("submenu" + sid + ".style.display=\"\";"); //显示当前菜单
iShowMenu = sid; //设置变量iShowMenu值为当前菜单ID
}
else{ //如果当前目录已经被显示
eval("submenu" + sid + ".style.display=\"none\";"); //隐藏当前目录
iShowMenu = -1;//设置变量iShowMenu值为-1
}
}
var iShowMenu = -1;
function showsubmenu(sid)
{
whichEl = eval("submenu" + sid); //拼接你所点击的目录ID
if (whichEl.style.display == "none"){ //如果当前目录没被显示
if (iShowMenu != -1){ //如果有下级菜单
eval("submenu" + iShowMenu + ".style.display=\"none\";"); //下级菜单隐藏
}
eval("submenu" + sid + ".style.display=\"\";"); //显示当前菜单
iShowMenu = sid; //设置变量iShowMenu值为当前菜单ID
}
else{ //如果当前目录已经被显示
eval("submenu" + sid + ".style.display=\"none\";"); //隐藏当前目录
iShowMenu = -1;//设置变量iShowMenu值为-1
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询