敲代码利用JavaScript+DIV+CSS实现下拉菜单
<!--程序ch02_11_Menu.html-->
<html>
<head>
<title>下拉菜单示例</title>
<script language="javaScript">//当鼠标移动到菜单选项的时候显示对应的Div
function show(menu)
{dounment.getElementById(menu).style.visibility="visible";}
//当鼠标溢出的时候隐藏所有的DIV
function hide(){
document.getElementById("menu1").style.visibility="hidden";
document.getElementById("menu2").style.visibility="hidden";
document.getElementById("menu3").style.visibility="hidden";
}
</script>
</head>
<body>
<table>
<tr bgcolor="#9999FF"align="center">
<td width="120" onMouseMove="show(‘menu1‘)"onMouseOut="hide()">系列课程</td>
<td width="120" onMouseMove="show(‘menu2‘)"omMouseOut="hide()">教学课件</td>
<td width="120" onMouseMove="show(‘menu3‘)"onMouseOut="hide()">课程大纲</td>
</tr>
</table>
<div id="menu1"
</body>
未完待续!!!!
时间: 2024-11-05 11:39:55