:织梦模版JS代码实现导航高亮显示!这里是模板文件.HTM里面的代码,下面的JS加载导航代码的下面。
<div id="menu">
<ul>
<li><a href="" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >网站首页</a></li>
<li><a href="" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >免费模板</a></li>
</ul>
</div>
<script type="text/javascript" language="javascript">
var nav = document.getElementById("menu");
var links = nav.getElementsByTagName("li");
var lilen = nav.getElementsByTagName("a");
var currenturl = document.location.href;
var last = 0;
for (var i=0;i<links.length;i++)
{
var linkurl = lilen[i].getAttribute("href");
if(currenturl.indexOf(linkurl)!=-1)
{
last = i;
}
}
links[last].className = "menu_on";
</script>