Используйте <!--#include virtual="/PathToYour/Page/navigation.asp"-->
на странице, где вы хотите, чтобы появилась ваша страница navigation
.
navigation.asp:
<a class="nav-link" href="link1.asp">Link 1</a>
<a class="nav-link" href="link2.asp">Link 2</a>
А затем с помощью jQuery автоматизируйте ваш класс "active" или "currentPage" для ссылок.
<script>
$(document).ready(function () {
//Loop through all <a href> elements and see if it matches current page, if it does add "active" class to that link
$("a").each(function () {
if ($(this).attr("href") === window.location.pathname) {
$(this).addClass("active");
} else if ($(this).attr("href") === window.location.href) {
$(this).addClass("active");
} else if ($(this).attr("href") === window.location.pathname + window.location.search) {
$(this).addClass("active");
}
});
});
</script>
образец home.asp (со всеми видами «шаблонов» --- верхний и нижний колонтитулы, функции и т. Д.):
<% Option Explicit %>
<!-- #include virtual="/local/scripts/vbs/settings.asp" -->
<!-- #include virtual="/global/scripts/vbs/db.asp" -->
<!-- #include virtual="/global/scripts/vbs/format.asp" -->
<!-- #include virtual="/global/scripts/vbs/pages.asp" -->
<!-- #include virtual="/global/shared/templates/inc-doctype.asp" -->
<html lang="en">
<head>
<title><%=PageTitle & gWebTitle%></title>
<meta name="description" content="<%=TitlePageHeading%>">
<!-- #include virtual="/global/shared/templates/inc-meta.asp" -->
<!-- #include virtual="/global/shared/templates/inc-styles.asp" -->
<!-- #include virtual="/global/shared/templates/inc-scripts.asp" -->
</head>
<body>
<!-- #include virtual="/local/scripts/templates/header.inc" -->
<%
'Main Page Content Goes Here
%>
<!-- #include virtual="/local/scripts/templates/footer.inc" -->
<script>
$(document).ready(function () {
//Loop through all <a href> elements and see if it matches current page, if it does add "active" class to that link
$("a").each(function () {
if ($(this).attr("href") === window.location.pathname) {
$(this).addClass("active");
} else if ($(this).attr("href") === window.location.href) {
$(this).addClass("active");
} else if ($(this).attr("href") === window.location.pathname + window.location.search) {
$(this).addClass("active");
}
});
});
</script>
</body>
</html>