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

獲取隨機顏色刷新給新色并產(chǎn)生隨機數(shù)

オリジナル 2019-02-09 14:58:51 225
サマリー:代碼這東西很嚴謹,練習(xí)過程中就因為引號前沒打空格郁悶了半天沒找到問題。接著又是撤銷的時候總認為刪掉哪行代碼就可以,又掉坑里了。好多坑呀。。。知識點:靈活運用所學(xué)到的知識。parseInt()將字符串轉(zhuǎn)換為整數(shù)類型,忽略非數(shù)字類型click () 點擊事件 mouseover() 鼠標移上事件mouseleave()鼠標離開事件+ 拼接字符串新知識點:Math.random()返回介于 0 ~ 1

代碼這東西很嚴謹,練習(xí)過程中就因為引號前沒打空格郁悶了半天沒找到問題。接著又是撤銷的時候總認為刪掉哪行代碼就可以,又掉坑里了。好多坑呀。。。

知識點:靈活運用所學(xué)到的知識。

parseInt()將字符串轉(zhuǎn)換為整數(shù)類型,忽略非數(shù)字類型

click () 點擊事件 mouseover() 鼠標移上事件mouseleave()鼠標離開事件

+ 拼接字符串

新知識點:Math.random()返回介于 0 ~ 1 之間的一個隨機數(shù)。

<!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>

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

<style>

a{

float: left;

display: block;

margin: 50px;

width: 100px;

line-height: 100px;

color: rgb(243, 235, 235);

border-radius: 50px;

text-align: center;

text-decoration: none;

/* background: #ccc; */

}

</style>

</head>

<body>

<script type="text/javascript">

function aa(tag) {

var len=document.getElementsByTagName(tag).length

for (let 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)+')'

}

}

$(function(){

aa('a')

$('button').click(function(){

$b=parseInt(Math.random()*10)

aa('a')

$('a').text($b)

})

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

$bg=$(this).css('backgroundColor')

$(this).css('box-shadow','0px 0px 20px '+$bg)

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

})

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

$bg=$(this).css('backgroundColor')

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

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

})

})

/* $(document).ready(function(){

       aa('a')

   }) */

</script>

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

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

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

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

<button>刷新</button>

</body>

</html>




添削の先生:查無此人添削時間:2019-02-11 09:33:13
先生のまとめ:作業(yè)完成的不錯??又饕悄氵€不熟悉,熟悉的話,就不會有常規(guī)錯誤了。繼續(xù)加油。

手記を発表する

人気のある見出し語