国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

JQuery案例二,隨機(jī)顏色作業(yè)和問(wèn)題

Original 2018-11-09 00:21:25 214
abstract:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> a{ text-decoration:non
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
a{
text-decoration:none;
width:100px;
height:100px;
margin:100px 100px;
text-align:center;
line-height:100px;
display:inline-block;
border-radius:50px;
background-color:red;
color:black;
}
</style>
<script type="text/javascript" src="js/jquery.js"></script>
</head>
<body>
<a href="#">1</a>
<a href="#">2</a>
<a href="#">3</a>
<a href="#">4</a>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
a{
text-decoration:none;
width:100px;
height:100px;
margin:100px 100px;
text-align:center;
line-height:100px;
display:inline-block;
border-radius:50px;
/*background-color:rgb(100,200,100);*/
color:black;
}
</style>
<script type="text/javascript" src="js/jquery.js"></script>
</head>
<body>
<a href="#">1</a>
<a href="#">2</a>
<a href="#">3</a>
<a href="#">4</a>

    <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)
            $(this).css('border-radius','20px ')
           })
            $('a').mouseleave(function(){
            $(this).css('box-shadow','none')
            $(this).css('border-radius','50px ')
           })
        })
    </script>


</body>
</html>
    </script>

</body>
</html>

為什么我變成8個(gè)圈圈了,還有隨機(jī)數(shù)字那段看著糊里糊涂的,我拆散了去書(shū)寫(xiě)都沒(méi)有問(wèn)題,但是一結(jié)合放到rgb里就各種沒(méi)效果。哪里放分號(hào)?還有那里為什么要放+號(hào)我是完全分不清了。求老師耐心解答一下

Correcting teacher:韋小寶Correction time:2018-11-09 09:10:57
Teacher's summary:加號(hào)是用于連接的!分號(hào)就是用于區(qū)分的!詳細(xì)的問(wèn)題還得標(biāo)記好到工單中提問(wèn)哦!這里只能簡(jiǎn)單的解答一下!繼續(xù)加油吧!

Release Notes

Popular Entries