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

獲取隨機(jī)顏色

asal 2019-02-15 16:57:32 192
abstrak:總結(jié):真是少個空格,都會出問題。要細(xì)心一點(diǎn)。。代碼:<!DOCTYPE html><html><head> <title>獲取隨機(jī)顏色</title> <style type="text/css"> a{ float:left; display:block; margin:50px; w

總結(jié):

真是少個空格,都會出問題。要細(xì)心一點(diǎn)。。

代碼:

<!DOCTYPE html>

<html>

<head>

<title>獲取隨機(jī)顏色</title>


<style type="text/css">

a{

float:left;

display:block;

margin:50px;

width:100px;

height:100px;

text-align: center;

line-height: 100px;

background-color:#ffe411;

text-decoration: none;

border-radius: 50px;

}

</style>

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

<script type="text/javascript">

//改變標(biāo)簽的背景顏色

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); //20px 后面有個空格,調(diào)試了半天。我的天。

$(this).css('border-radius', '20px');

})


$('a').mouseleave(function(){

$(this).css('box-shadow', 'none');

$(this).css('border-radius', '50px');

})

})

</script>

</head>

<body>


<a href="#">1</a>

<a href="#">2</a>

<a href="#">3</a>

<a href="#">4</a>

</body>

</html>


Nota Keluaran

Penyertaan Popular