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

jQuery css style manipulation

css style operation

  • ##$().css(name, value); //Settings

  • $().css(name); //Get

  • $().css(json object); //Modify multiple css at the same time Style

css() style operation features: ① Style acquisition, jquery can obtain inline, Interior and exterior styles.
The dom method can only obtain inline styles
② Composite attribute styles need to be split into "specific styles" before they can be operated
For example: background needs to be split into background-color background-image, etc. for operation
border: border-left-style border-left-width border-left-color, etc.
margin: margin-left, margin-top, etc.

<!DOCTYPE html>
<html>
    <head>
        <title>php.cn</title>
        <meta charset="utf-8" />
        <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
        <script>
           function f1(){
                alert($('div').css('background-color'));
           }
           function f2(){
            $('div').css('background-color','red')
           }
           function f3(){
                var jn={'width':'300px','height':'300px'};
                $('div').css(jn);
           }
        </script>
    </head>
    <body>
        <div style="width:200px; height:150px; background-color:lightblue;">歡迎大家學(xué)習(xí)jQuery</div>
        <input type="button" value="獲取背景色" onclick="f1()" />
        <input type="button" value="設(shè)置背景色" onclick="f2()" /> 
        <input type="button" value="批量設(shè)置" onclick="f3()" /> 
    </body>
</html>


Continuing Learning
||
<!DOCTYPE html> <html> <head> <title>php.cn</title> <meta charset="utf-8" /> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> <script> function f1(){ alert($('div').css('background-color')); } function f2(){ $('div').css('background-color','red') } function f3(){ var jn={'width':'300px','height':'300px'}; $('div').css(jn); } </script> </head> <body> <div style="width:200px; height:150px; background-color:lightblue;">歡迎大家學(xué)習(xí)jQuery</div> <input type="button" value="獲取背景色" onclick="f1()" /> <input type="button" value="設(shè)置背景色" onclick="f2()" /> <input type="button" value="批量設(shè)置" onclick="f3()" /> </body> </html>
submitReset Code