日期:2014-05-16  浏览次数:20324 次

哪个帮我看一下脚本有什么问题
<!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=gb2312" />
<title>无标题文档</title>
<style>
  .DvHeader { height:30px; background-color:#B0FFFF; border-bottom:1px solid #313131; text-align:left; } 
  .DvHeader .Act { float:left; display:block; width:80px; height:30px; line-height:30px; border-top:1px solid #313131; border-left:1px solid #313131; border-right:1px solid #313131; background-color:#FFFFFF; text-align:center; font-size:14px; font-weight:bold; text-decoration: none;}
  .DvHeader .Normal {display:block; width:80px; height:30px; line-height:30px; text-align:center; font-size:14px; font-weight:bold; text-decoration: none; float:left; }
</style>

<script>
  function HeaderClick(obj)
  {
  var head=document.getElementById("LinkHead");
var info=document.getElementById("LinkCenter");
var center=document.getElementById("LinkAbout");
var id=obj.id;

switch(id)
{  
case "LinkHead":  
head.className="Act"; 
info.className="Normal";
center.className="Normal";  
break;
case "LinkCenter":
head.className="Normal"; 
info.className="Act";
center.className="Normal";  
break;
case "LinkAbout":
head.className="Normal"; 
info.className="Normal";
center.className="Act";  
break;
}
alert("");
  }
</script>
</head>

<body>
<div style="text-align:center;">
  <div style="width:90%;">
<div class=DvHeader>
<a id="LinkHead" href="javascript" onclick="HeaderClick(this)" class="Act" style="margin-left:10px;" >首页</a>

<a id="LinkCenter" href="javascript" onclick="HeaderClick(this)" class="Normal">个人中心</a>
<a id="LinkAbout" href="javascript" onclick="HeaderClick(this)" class="Normal">关于</a>
</div>
</div>
</div>
</body>
</html>


------解决方案--------------------
<a id="LinkHead" href="javascript:void(0);" onclick="HeaderClick(this)" class="Act" style="margin-left:10px;" >首页</a>
<a id="LinkCenter" href="javascript:void(0);" onclick="HeaderClick(this)" class="Normal">个人中心</a>
<a id="LinkAbout" href="javascript:void(0);" onclick="HeaderClick(this)" class="Normal">关于</a>