我正在开发一个 MVC4 应用程序
我有以下菜单项
<ul class="menu left">
<li>@Html.ActionLink("Home", "Index", new { Controller = "Home" }, new { @class = "active" })</li>
<li>@Html.ActionLink("About Us", "About", new { Controller = "Home" })</li>
<li>@Html.ActionLink("Services", "Services", new { Controller = "Home" })</li>
<li>@Html.ActionLink("Post Job", "Create", new { Controller = "JobPosting" })</li>
<li>@Html.ActionLink("Job Search", "Index", new { Controller = "JobPosting" })</li>
<li>@Html.ActionLink("Contact Us", "Contact", new { Controller = "Home" })</li>
</ul>
现在我想如果我点击 Home 以外的项目,它的 css 类会变为活动状态。基本上我只想改变菜单项的颜色我怎样才能动态地做到这一点?