复制代码代码如下:
<! Doctype html public "-// w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<голова>
<meta http-equiv = "content-type" content = "text /html; charset = utf-8" />
<title> 可折叠弹出式菜单 </title>
</head>
<style>
Body {foangy-color: #fff; color: #000;}
div {margin-bottom: 10px;}
ul.menu {display: none; тип списка в стиле: none; margin-top: 5px;}
A.menulink {font-size: 16px; font-weight: bold;}
</style>
<script type = "text/javascript">
window.onload = initall;
function initall () {
var alllinks = document.getElementsbytagname ("a");
for (var i = 0; i <alllinks.length; i ++) {
if (alllinks [i] .classname.indexof ("menulink")> -1) {
alllinks [i] .onclick = togglemenu;
}
}
}
function togglemenu () {
var startMenu = this.href.lastIndexof ("/")+1;
var stopmenu = this.href.lastindexof (".");
var thismenuname = this.href.substring (startmenu, stopmenu);
var thismenu = document.getElementById (thisMenuname) .Style;
if (thismenu.display == "block") {
thismenu.display = "нет";
}
еще {
thismenu.display = "block";
}
вернуть ложь;
}
</script>
<тело>
<h1> Shakespeare's Plays </h1>
<div>
<a href = "menu1.html"> comdeis </a>
<ul id = "menu1">
<li> <a href = "pg1.html"> Все хорошо, что хорошо заканчивается </a> </li>
<li> <a href = "pg2.html"> как вам это нравится </a> </li>
<li> <a href = "pg3.html"> Love's Laves's Last </a> </li>
<li> <a href = "pg4.html"> комедия ошибок </a> </li>
</ul>
</div>
<div>
<a href = "menu2.html"> трагедии </a>
<ul id = "menu2">
<li> <a href = "pg5.html"> Anthony & Cleopatra </a> </li>
<li> <a href = "pg6.html"> Гамлет </a> </li>
<li> <a href = "pg7.html"> Romeo & Juliet </a> </li>
</ul>
</div>
<div>
<a href = "menu3.html"> Истории </a>
<ul id = "menu3">
<li> <a href = "pg8.html"> Генри IV, часть 1 </a> </li>
<li> <a href = "pg9.html"> Генри IV, часть 2 </a> </li>
</ul>
</div>
</body>
</html>