日期:2014-05-16 浏览次数:20523 次
<html>
<head>
<title>折叠菜单</title>
</head>
<style>
<!--
body { font-size:12pt;}
a { font-size:10pt;}
.red {color:red;}
.menu {
color:blue;
cursor:hand;
}
.submenu{
margin-left:0.3in;
}
-->
</style>
<script language="JavaScript" type="text/javascript">
<!--
function menuChange(){
var obj = window.event.srcElement;
var subid;
if(obj != null)
{
if(obj.className == "menu"){
subid = "sub"+obj.id;
if(document.all(subid).style.display == "none")
document.all(subid).style.display = "";
else
document.all(subid).style.display = "none";
}
}
}
//-->
</script>
<body>
<h1 align="center">折叠菜单</h1>
<span id="menu1" class="menu" onClick="menuChange()">菜单项1</span>
<div id="submenu1" style="display:none">
<div class="submenu">
<a>子菜单项1</a><br/>
<a>子菜单项2</a><br/>
<a>子菜单项3</a><br/>
</div>
</div>
</body>
</html>