点击菜单后,菜单具有不同的底色
<!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>
<link href="style.css" rel="stylesheet" type="text/css" />
<script>
function changeMenu(){
var arg=arguments;
}
</script>
</head>
<body>
<table width="100%" height="225" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" bgcolor="#FFFFFF"><table id="changeMenu" cellspacing="0" cellpadding="0" width="180"
border="0">
<tbody>
<tr>
<td class="biao3">关于联友</td>
</tr>
<tr>
<td class="ir_d_title"><a href="gsjs.aspx" target="_top">公司介绍</a></td>
</tr>
<tr>
<td class="ir_d_title"><a href="gsyw.aspx" target="_top">业务介绍</a></td>
</tr>
<tr>
<td class="ir_d_title"><a href="xwzx.aspx" target="_top">新闻中心</a></td>
</tr>
<tr>
<td class="ir_d_title"><a href="gsry.aspx" target="_top">公司荣誉</a></td>
</tr>
<tr>
<td class="ir_d_title"><a href="lianxi.aspx" target="_top">联系我们</a></td>
</tr>
<tr>
<td class="bei"></td>
</tr>
</tbody>
</table></td>
</tr>
</table>
</body>
<script>
function changeMenu()
{
var arg = [];
arg[0] = "ir_d_title";
arg[1] = "ir_d_title2";
var _id = document.getElementById("changeMenu");
var _pclick = arguments[0] ? arguments[0] : 0;
var _link = _id.getElementsByTagName("a");
for (var i = 0; i < _link.length; i++)
{
if (_pclick == i)
{
_link[i].parentNode.className = arg[1];
_link[i].onmouseover = function () { }
_link[i].onmouseout = function () { }
_link[i].onclick = function () { }
}
else
{
_link[i].parentNode.className = arg[0];
_link[i].onmouseover = function () { this.parentNode.className = arg[1]; }
_link[i].onmouseout = function () { this.parentNode.className = arg[0]; }
_link[i].onclick = (function (a) { return function () { changeMenu(a); }; })(i)
}
}
}
function $QueryString(item)
{
var sValue = location.search.match(new RegExp("[\?\&]" + item + "=([^\&]*)(\&?)", "i"));
return sValue ? sValue[1] : sValue
}
changeMenu($QueryString("m"));
</script>
</html>
源代码如上。我想实现的效果:比如点击“公司介绍”,那么“公司介绍”那一行就和其他行具有不同的底色。 --------------------编程问答-------------------- <td class="ir_d_title" id="aa"><a href="gsjs.aspx" target="_top">公司介绍</a></td>
$("#aa").click(function(){$("#aa").attr("class",'other_class')}); 点击事件改变样式 other_class
other_class样式里面定义背景颜色
--------------------编程问答-------------------- 对click中改变颜色 --------------------编程问答-------------------- 本人ASP.NET菜鸟。
能不能说的具体点? --------------------编程问答-------------------- 菜单
补充:.NET技术 , ASP.NET