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

jQuery-CSS ??? ? ???

jQuery - CSS ??? ? ???

jQuery - CSS ??? ???? ? ??

jQuery ?? CSS

jQuery?? CSS ??? ???? ?? ?? ???? ????. ?? ??? ?????:

addClass() - ??? ??? ?? ??? ??? ??

removeClass() - ??? ???? ?? ??? ??? ??

toggleClass() - ??? ??? ?? /??? ?? ?? ??

css() - ??? ?? ?? ?? ??

???? ?????

?? ?????? ? ???? ?? ??? ?????:

.important{
font-weight:bold;
font-size:xx-large;
}.
blue{
color:blue;
}

jQuery addClass() ???

?? ?? ??? ??? ???? ??? ?????. ?? ???. ??, ???? ??? ? ?? ??? ??? ?? ????.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("h1,h2,p").addClass("blue");
    $("div").addClass("important");
  });
});
</script>
<style type="text/css">
.important
{
font-weight:bold;
font-size:xx-large;
}
.blue
{
color:blue;
}
</style>
</head>
<body>
<h1>靜夜思</h1>
<p>床前明月光</p>
<p>疑是地上霜</p>
<p>這是另外一個段落。</p>
<div>這是一些重要的文本!</div>
<br>
<button>為元素添加 class</button>
</body>
</html>

addClass() ????? ?? ???? ??? ?? ????.

<head>
<meta charset="utf-8">
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("#div1").addClass("important blue");
  });
});
</script>
<style type="text/css">
.important
{
    font-weight:bold;
    font-size:xx-large;
}
.blue
{
    color:blue;
}
</style>
</head>
<body>
<div id="div1">我會變哦</div>
<div id="div2">為什么我不行呢</div>
<br>
<button>為第一個 div 元素添加類</button>
</body>
</html>

jQuery RemoveClass() ???

?? ???? ?? ??? ?????. ?? ??? ??? ??? ??:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("h1,h2,p").removeClass("blue");
  });
});
</script>
<style type="text/css">
.important
{
font-weight:bold;
font-size:xx-large;
}
.blue
{
color:blue;
}
</style>
</head>
<body>
<h1>靜夜思</h1>
<p>床前明月光</p>
<p>疑是地上霜</p>
<p>這是另外一個段落。</p>
<div>這是一些重要的文本!</div>
<br>
<button>從元素中移除 class</button>
</body>
</html>

addclass? ??? ??????.

jQuery ?????() ???

?? ?? ??:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("h1,h2,p").toggleClass("blue");
  });
});
</script>
<style type="text/css">
.blue
{
color:blue;
}
</style>
</head>
<body>
<h1 class="blue">標(biāo)題 1</h1>
<h2 class="blue">標(biāo)題 2</h2>
<p class="blue">這是一個段落。</p>
<p>這是另外一個段落。</p>
<br>
<button>切換 class</button>
</body>
</html>

jQuery css() ???

css() ???? ??? ??? ?? ??? ??? ??? ????? ?????.

CSS ?? ??

??? CSS ??? ?? ???? ?? ?? ?? ??? ?????.

css("propertyname");

CSS ?? ??

??? ?? ??? CSS ??? ????? ?? ??? ?????:

css("propertyname","value");

?? CSS ?? ??

?? CSS ??? ???? ?? ?? ?? ??? ?????.

css({"propertyname" :"value","propertyname":"value",...});

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("p").css({"background-color":"yellow","font-size":"200%"});
  });
});
</script>
</head>
<body>
<h2>這是一個標(biāo)題</h2>
<p style="background-color:#ff0000">這是一個例子</p>
<p style="background-color:#00ff00">這是一個例子</p>
<p style="background-color:#0000ff">這是一個例子</p>
<p>這是一個例子</p>
<button>為 p 元素設(shè)置多個樣式</button>
</body>
</html>


???? ??
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $("p").css("background-color","yellow"); }); }); </script> </head> <body> <h2>這是一個標(biāo)題</h2> <p style="background-color:#ff0000">我們是例子</p> <p style="background-color:#00ff00">我們是例子</p> <p style="background-color:#0000ff">我們是例子</p> <p>我們是例子</p> <button>設(shè)置 p 元素的 background-color </button> </body> </html>