<a href="">1</a>
<a href="">2</a>
<a href="">3</a>
<a href="">4</a>
a{display: block;width: 100px;height: 100px;line-height:100px;margin:100px;text-decoration: none;text-align: center;float: left;border-radius: 50px;}
function changeColor(tag){
var len = document.getElementsByTagName(tag).length;
for(var i=0;i<len;i++){
document.getElementsByTagName(tag)[i].style.backgroundColor = 'rgb('+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+')';
}
//document.write('rgb('+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+')');
}
$(document).ready(function(){
changeColor('a');
$('a').mouseover(function(){
$color = $(this).css('backgroundColor');//获取当前颜色,给光晕填充
$(this).css('box-shadow','0px 0px 20px '+$color);
$(this).css('border-radius','20px');
});
$('a').mouseout(function(){
$(this).css('box-shadow','none');
$(this).css('border-radius','50px');
});
});
