加个css就好了<style type="text/css">
a:link,a:visited {
background-color:red;
}
a:hover,a:active {
background-color:blue;
}
</style>
具体颜色可以自己改下 另外提一下 html标签用大写是什么习惯?
a:link,a:visited {
background-color:red;
}
a:hover,a:active {
background-color:blue;
}
</style>
具体颜色可以自己改下 另外提一下 html标签用大写是什么习惯?
ul li{ width:60px; height:20px; background:#CCC; color:#000;}
ul li a{ width:60px; height:20px; display:inline-block;}
ul li.cur{ background:#EEE;}
</style>
<script type="text/javascript">
$(function(){
$("ul li").click(function(){
$(this).addClass("cur").siblings().removeClass("cur");
})
})
</script>
楼主的结束标签没写完整
你好,不行呀。
我可能没描述清楚,我想要的效果是
点击超链接 跳转 然后此导航变色 其余的不变。改成这样试试<style type="text/css">
a:link {
background-color:red;
}
a:hover,a:active,a:visited {
background-color:blue;
}
</style>
$(function(){
$("ul li").click(function(){
$(this).find("a").addClass("bianse");
$(this).siblings().find("a").removeClass("bianse");
});
})
/*你的样式在a标签里面不是在li里面*/
你直接在那页面上加class就可。
elem.addclass(xxxx)
}
<LI><A class="bianse" href="a.aspx">导航一</A> </LI>
<LI><A href="b.aspx">导航二</A> </LI>
<LI><A href="c.aspx">导航三</A> </LI>
</UL><style>
a.focus{background:#ff0000;color:#ffffff;}
</style>
<script>
var pn = location.pathname;
var as = document.getElementById('ulGuider').getElementsByTagName('a'), find = false;
for (var i = 0, j = as.length; i < j; i++)
if (as[i].href.indexOf(pn) != -1) { as[i].className = 'focus'; find = true; break; }
//if (!find) as[0].className = 'focus';//如果未找到匹配的,需要设置哪个获取焦点可以修改这句
</script>
var $match = $h.match(/.*\/(.*\.aspx)$/);
var $m=$match[1];
$('a[href="'+$m+'"]').addClass("bianse");
结贴。