1: 遍历css 相关dom的值
实现效果:
<script type="text/javascript" src="/js/jquery/jquery-1.8.1.min.js"></script>
<a href="tiepian_add.jsp" title="创建贴片">
<button class="button orange1 medium">创建贴片</button>
</a>
<a href="tiepian_list.jsp" title="贴片列表">
<button class="button orange2 medium">贴片列表</button>
</a>
<a href="tiepian_fabu.jsp" title="已经发布的微信号">
<button class="button orange medium">发布通知</button>
</a>
<script type="text/javascript">
$(".button").each(function(index,dom){
if(index==1){
$(this).toggleClass("orange", false);
$(this).toggleClass("white", true);
}else{
$(this).toggleClass("orange", true);
$(this).toggleClass("white", false);
}
})
</script>
实现效果: