abstrait:<!DOCTYPE html><html><head><meta charset="UTF-8"><title>獲取隨機(jī)顏色</title><script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></sc
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>獲取隨機(jī)顏色</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>
Professeur correcteur:滅絕師太Temps de correction:2019-01-11 16:50:42
Résumé du professeur:跟課堂源碼基本一致~并且沒有按照要求完成作業(yè)~給你批是因?yàn)橄胱屇憧焖龠M(jìn)入后面的學(xué)習(xí)