日期:2014-05-16 浏览次数:20333 次
<div id="dvGuider">
<a href="1.html">1.html</a>
<a href="2.html">2.html</a>
<a href="3.html">3.html</a>
<a href="4.html">4.html</a>
</div>
<style>
a.focus{background:#ff0000;color:#ffffff;}
</style>
<script>
var pn = location.pathname;
var as = document.getElementById('dvGuider').getElementsByTagName('a');
for (var i = 0, j = as.length; i < j; i++)
if (as[i].href.indexOf(pn) != -1) {as[i].className = 'focus';break;}
</script>
<!doctype>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
a.mouseOver {
background-color: red;
}
</style>
<script type="text/javascript">
window.onload = function(){
var lis = document.getElementById("links").getElementsByTagName("li");
for (var i = lis.length - 1; i >= 0; i--) {
var aE = lis[i].getElementsByTagName("a")[0];
aE.addEventListener("mouseover", changeBackgroud);
aE.addEventListener("mouseout", changeBackgroud);
}
&n