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

隨機(jī)顏色和隨機(jī)數(shù)值的作業(yè)

Original 2019-02-25 16:42:37 268
abstract:<!DOCTYPE html><html><head>    <meta charset="utf-8"> <title>jQuery的動(dòng)畫效果--獲取隨機(jī)顏色</title> <script type="text/javascript" src="j

<!DOCTYPE html>

<html>

<head>

    <meta charset="utf-8">

<title>jQuery的動(dòng)畫效果--獲取隨機(jī)顏色</title>

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

  <style type="text/css">

  a{float:left;

    display:block;

    margin:50px;

    width:100px;

    height:100px;

    line-height: 100px;

    text-align:center;

    color:#fff;

    border-radius:50px;

    text-decoration: none;

    }

    .but1{width:200px;height:60px;margin-top:68px;}

  </style>

  <script type="text/javascript">

    function sjcolor(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)+')'

      }

    }

    function sjshu(tag){

      var len=document.getElementsByTagName(tag).length

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

        document.getElementsByTagName(tag)[i].innerText=Math.floor(Math.random()*100+1)

      }

    }

    $(document).ready(function(){

      // sjcolor('a')

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

        sjcolor('a')

        sjshu('a')

      })

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

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

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

        $(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>

<button class="but1">點(diǎn)擊改變</button>

</body>

</html>

老師 如果我想把那個(gè)button放到四個(gè)圈圈的下面 css該怎么寫。。。一下子想不起來了 還有jquery和js用的時(shí)候很容易搞混,可能是因?yàn)榍昂髮W(xué)習(xí)的關(guān)系,有沒有什么好的辦法呢?

Correcting teacher:韋小寶Correction time:2019-02-25 17:37:59
Teacher's summary:button放到四個(gè)圈圈的下面 這個(gè)css你能不會(huì)寫??? 之前css是怎么學(xué)的 你可以把4個(gè)a標(biāo)簽和一個(gè)按鈕放在一個(gè)div中 再把樣式改一下就可以 樣式修改的方法有很多種 這個(gè)要靠自己去練習(xí)的 jQuery的所有語法都比js的要簡潔 要記得多去練習(xí)多去練習(xí)多去練習(xí) 不要感覺看視頻懂了就不用練習(xí)了

Release Notes

Popular Entries