摘要:<!DOCTYPE html><html><head><meta charset="UTF-8"><title>获取随机颜色</title><script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></sc
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>获取随机颜色</title>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
<style>
a{
float:left;
display: block;
margin: 50px;
width: 100px;
line-height: 100px;
text-align: center;
height: 100px;
color: #fff;
border-radius: 50px;
text-decoration: none;
}
</style>
<script>
function aa(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).ready(function(){
aa('a')
$('a').mouseover(function(){
$bg=$(this).css('backgroundColor')
$(this).css('box-shadow','0px 0px 20px '+$bg)
$(this).css('box-radius','20px ')
})
$('a').mouseleave(function(){
$bg=$(this).css('backgroundColor')
$(this).css('box-shadow','none')
$(this).css('box-radius','50px')
})
})
</script>
</head>
<body>
<a href="#">a</a>
<a href="#">b</a>
<a href="#">c</a>
<a href="#">d</a>
</body>
</html>
批改老师:灭绝师太批改时间:2019-01-11 16:50:42
老师总结:跟课堂源码基本一致~并且没有按照要求完成作业~给你批是因为想让你快速进入后面的学习