在Head部,添加如下代码,
<style>#menu li.active{ color:red;}</style>@{ string requestUrl = Request.Url.ToString(); } <script> $(function() { if (‘@requestUrl‘ == "") return; var arr = ["/Print", "/Report", "/ReprotManage", "/Check"]; //连接菜单a中的href值 $.each(arr, function(i, v) { if (‘@requestUrl‘.indexOf(v) != -1) $("#menu li a[href$=‘" + v + "‘]").attr("href", "javascript:void(0)").parent().addClass("active"); }); }); </script>
时间: 2024-11-29 03:34:32