国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

點擊獲取隨機顏色

Original 2019-05-21 12:05:25 224
abstract:!DOCTYPE html><html><head> <title>點擊獲取隨機顏色</title> <script src="http://code.jquery.com/jquery-3.1.1.min.js"></script> <style type=&qu

!DOCTYPE html>
<html>
<head>
<title>點擊獲取隨機顏色</title>
<script src="http://code.jquery.com/jquery-3.1.1.min.js"></script>
<style type="text/css">
*{margin: 0;padding: 0;}
a{
float: left;
display: block;
width: 150px;
height: 80px;
line-height: 80px;
text-align: center;
text-decoration: none;
border-radius: 10px;
color: #fff;
margin: 50px;
}
button{float: left;margin-top: 180px;margin-left: -122px;}
</style>
</head>
<body>
<a href="javascript:;" onclick="randBg(this)">0</a>
<a href="javascript:;" onclick="randBg(this)">0</a>
<a href="javascript:;" onclick="randBg(this)">0</a>
<a href="javascript:;" onclick="randBg(this)">0</a>
</body>
</html>
<script type="text/javascript">
// 每次刷新瀏覽器隨機給小球添加顏色
function setBg(tag){
var len = document.getElementsByTagName(tag).length;
console.log(len);
for(var i=0; i<len; i++){
document.getElementsByTagName(tag)[i].style.backgroundColor = 'rgb('+Math.floor(Math.random()*255)+','+Math.floor(Math.random()*255)+','+Math.floor(Math.random()*255)+')';
}
}

// 點擊按鈕改變小球的顏色
function randBg(obj){
obj.style.backgroundColor = 'rgb('+Math.floor(Math.random()*255)+','+Math.floor(Math.random()*255)+','+Math.floor(Math.random()*255)+')';
var bg = obj.style.backgroundColor;
console.log(bg);
obj.innerHTML = bg;
}

$(document).ready(function(){
setBg('a');

$('a').mouseover(function(){
$bg = $(this).css('backgroundColor');
$(this).css('boxShadow','0px 0px 20px '+$bg);
});

$('a').mouseleave(function(){
$(this).css('boxShadow','none');
$(this).css('borderRadius','10px');
});
});
</script>

Correcting teacher:查無此人Correction time:2019-05-22 09:18:47
Teacher's summary:完成的不錯。看你寫了不少作業(yè),繼續(xù)加油。

Release Notes

Popular Entries