如下所示;
复制代码代码如下:
<!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">
<head>
<Meta http-equiv = "content-type" content = "text /html; charset = utf-8" />
<title>无标题文档</title>
<script type = "text/javascript">
関数change_bg(obj)
{
var a = document.getElementById( "メニュー")。getElementsByTagname( "a");
for(var i = 0; i <a.length; i ++)
{
a [i] .classname = "";
}
obj.classname = "current";
}
</script>
<style type = "text/css">
体{
フォントサイズ:17px;
}
。現在{
背景:赤;
}
#container ul
{
リストスタイルタイプ:なし;
}
#container ul li
{
フロート:左;
マージン右:3px;
}
#container ul li a {
テキスト装置:なし;
色:#000;
}
</style>
</head>
<body>
<div id = "container">
<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 = "change_bg(this)"> menu5 </a> </li>
</ul>
</div>
</body>
</html>