亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

隨機改變顏色,老師可以測試一下

原創(chuàng) 2018-11-19 16:06:50 231
摘要:<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">&

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta http-equiv="X-UA-Compatible" content="ie=edge">

<title>隨機顏色</title>

<link rel="stylesheet" href="css/php.css" type="text/css">

<script src="js/jquery-3.3.1.js"></script>

<script src="js/php.js" type="text/javascript"></script>

<style>

/* random */

.random{width: 1200px;margin: 0 auto;background: #ccc;margin-top: 40px;}

.random ul li{width: 100px;height: 100px;color: #000;border-radius: 50%;float: left;margin-right: 10px;line-height: 100px;

text-align: center;}

</style>

<script>

$(function(){

function ran(tag){

var tag1 = document.getElementsByTagName(tag).length;

for(var i=0;i<tag1;i++){

document.getElementsByTagName(tag)[i].style.backgroundColor='rgb('+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+

Math.floor(Math.random()*256)+')'

}

}

ran('li');

$('.random ul li').mouseover(function(){

var backg = $(this).css('backgroundColor');

$(this).css('background','backg');

$(this).css({'boxShadow':'0px 0px 20px #ccc','borderRadius':'10px'});

})

$('.random ul li').mouseleave(function(){

var backg = $(this).css('backgroundColor');

$(this).css({'borderRadius':'50%','backgroundColor':'backg','boxShadow':'none'})

})

})

</script>

</head>

<body>

<div class="random">

<ul>

<li>php</li>

<li>php</li>

<li>php</li>

<li>php</li>

<li>php</li>

</ul>

</div>

</body>

</html>


批改老師:滅絕師太批改時間:2018-11-19 16:17:10
老師總結:哎呀,你這個代碼顏色真好看……測試了效果不錯 繼續(xù)加油啊!

發(fā)布手記

熱門詞條