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

jquery-獲取隨機(jī)色,并已加入刷新按鈕

Original 2019-04-20 22:00:23 242
abstract:<!DOCTYPE html><html>   <head>     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />   &nbs

<!DOCTYPE html>
<html>
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <title>獲取隨機(jī)色</title>
     <script type="text/javascript" src="js/jquery.js"></script>
    <style type="text/css">
  a {
   float:left;
   display:block;
   margin:250px;
   width:500px;
   line-height: 500px;
   text-align: center;
   height:500px;
   color:#fff;
            border-radius: 50px;
            text-decoration: none;
  }
                button{
                    width: 300px;
                    height:100px;
                    background:#00ff00;
                   
                }
    </style>

    <script type="text/javascript">
     //改變標(biāo)簽的背景顏色
        $(document).ready(function(){
            $('button').click(function(){
               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)
            $(this).css('border-radius','20px ')
           })
            $('a').mouseleave(function(){
            $(this).css('box-shadow','none')
            $(this).css('border-radius','250px ')
           })
        })
    })
    })
    </script>
   </head>
   <body>
       <button>刷新</button>
     <a href="#">1</a>
  <a href="#">2</a>
  <a href="#">3</a>
  <a href="#">4</a>
   </body>
</html>


Correcting teacher:西門大官人Correction time:2019-04-22 10:06:57
Teacher's summary:隨機(jī)色的原理是什么?最好簡單寫一下。還有js代碼要加上分號,規(guī)范。群里說過很多次了

Release Notes

Popular Entries