<style>
ul li {
float: left;
height: 50px;
width: 120px;
color: white;
text-align: center;
margin-left: 5px;
list-style-type: none;
}
a{
color:white;
text-decoration:none;
}
.menu{
height: 50px;
background: #0094ff;
line-height: 50px;
}
.bgcolor {
background: red;
}
</style>
<script>
$(document).ready(function () {
$('.menu li a').each(function () {
if ($($(this))[0].href == String(window.location))
$(this).parent().addClass('bgcolor');
});
})
</script>
<div class="menu">
<ul style="list-style-type: none;">
<li><a href="/Test/Home" title="網站首頁" class="home">首頁</a></li>
<li><a href="/Test/A" title="測試導航">A測試導航</a></li>
<li><a href="/Test/B" title="測試導航">B測試導航</a></li>
<li><a href="/Test/C" title="測試導航">C測試導航</a></li>
</ul>
</div>
文章列表