我在ASP.NET Webforms应用程序中设计了布局的MasterPage。在这里
<div class="container">
<div class="row">
<div class="col-md-3">
<div class="list-group ">
<a href="UserProfile.aspx" id="dashboard" class="list-group-item list-group-item-action active">Dashboard</a>
<a href="AddEmployeeFather.aspx" class="list-group-item list-group-item-action">Add Employee Father</a>
<a href="#" class="list-group-item list-group-item-action">Search User</a>
<a href="#" class="list-group-item list-group-item-action">Print Information</a>
<a href="#" class="list-group-item list-group-item-action">Change Password</a>
<a href="#" class="list-group-item list-group-item-action">Logout</a>
</div>
</div>
<div class="col-md-9">
<asp:ContentPlaceHolder ID="MainContentPlaceHolder" runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
</div>
在加载时,UserProfile.aspx具有一个活动类,该类被突出显示。现在,我希望如果我单击AddEmployeeFather.aspx,此列表项将变为活动状态。这是我的jqyery代码
$(document).ready(function () {
var url = window.location;
$('.list-group .list-group-item').find('.active').removeClass('active');
$('.list-group .list-group-item a').each(function () {
if (this.href == url) {
$(this).parent().addClass('active');
}
});
});
我不知道问题出在哪里。请帮忙。预先感谢
答案 0 :(得分:1)
window.location是一个对象。使用window.location.href。
然后您可以找到具有相同网址的链接,并在链接上设置活动类
var doc = new Document(_basePathFileWord);
DocumentBuilder builder = new DocumentBuilder(doc);
NodeCollection paragraphs = doc.FirstSection.Body.GetChildNodes(NodeType.Paragraph, true);