如下所示;
复制代码代码如下:
<! Doctype html public "-// w3c // dtd xhtml 1.0 transitional // pt" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-bransitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv = "content-type" content = "text /html; charset = utf-8" />
<Title> 无标题文档 </title>
<script type = "text/javascript">
função alteração_bg (obj)
{
var a = document.getElementById ("menu"). getElementsByTagName ("A");
for (var i = 0; i <A.Length; i ++)
{
a [i] .className = "";
}
obj.className = "Current";
}
</script>
<style type = "text/css">
corpo{
Size da fonte: 17px;
}
.atual{
Antecedentes: vermelho;
}
#container ul
{
Tipo no estilo de lista: nenhum;
}
#container ul li
{
flutuar: esquerda;
Margem-direita: 3px;
}
#container ul li a {
Decoração de texto: Nenhum;
Cor:#000;
}
</style>
</head>
<Body>
<div id = "contêiner">
<ul id = "menu">
<li> <a href = "javascript:" onclick = "change_bg (this)"> menu1 </a> </li>
<li> <a href = "javascript:" onclick = "change_bg (this)"> menu2 </a> </li>
<li> <a href = "javascript:" onclick = "change_bg (this)"> menu3 </a> </li>
<li> <a href = "javascript:" onclick = "change_bg (this)"> menu4 </a> </li>
<li> <a href = "javascript:" onclick = "alteração_bg (this)"> menu5 </a> </li>
</ul>
</div>
</body>
</html>