摘要:<a href="">1</a> <a href="">2</a> <a href="">3</a> <a href="">4</a>a{display: block;
<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');
});
});
批改老师:灭绝师太批改时间:2018-11-14 10:44:02
老师总结:还有很多不同写法,可以自己尝试,把所学习的知识学以致用很重要!