87,997
社区成员




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<style type="text/css">
a{color:#000}
</style>
<script type="text/javascript" >
$(function(){
$("a").each(function(){
$(this).click(function(){
var index = $('a').index($(this))
$('a').not(index).css('color','#000');
$('a').eq(index).css('color','green');
})
})
})
</script>
</head>
<body>
<a href="#">1</a><a href="#">2</a><a href="#">3</a><a href="#">4</a>
</body>
</html>