最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

JQuery 中幾個類選擇器的簡單使用介紹

 更新時間:2013年03月14日 09:00:26   作者:  
類選擇器想必很多喜歡jquery的朋友早早就涉及到了吧,它們的使用也應(yīng)該了如指掌了吧,接下來幫大家溫習(xí)下幾個簡單類選擇器的使用方法,感興趣的你可以參考下哈,希望對你有所幫助
復(fù)制代碼 代碼如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestClassSelector.aspx.cs" Inherits="WebApplication1.TestClassSelector" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.9.0.min.js"></script>
<style type="text/css">
.first_div {
background-color:red;
}
.second_div {
background-color:green;
}
.first_span {
width:500px;
height:100px;
}
.eric_sun_class {
font-family:Arial;
font-size:18px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<div class="first_div">
This is the first div
</div>
<div class="second_div">
This is the second div
</div>
<div class="first_div">
<span class="first_span">
This is the first span
</span>
</div>
<span class="first_span eric_sun_class">
This is the first span + eric sun class.
</span>
<br />
<span class="eric_sun_class">
This is the eric sun class.
</span>
<br />
<input type="button" value="Test" onclick="btn_Click();" />
</div>
</form>
</body>
</html>
<script type="text/javascript">
function btn_Click() {
alert($(".first_div").text());
alert($(".first_div.first_span").text());
}
</script>

復(fù)制代碼 代碼如下:

$(".first_div, .first_span")

將包含有.first_div 或者 .first_span" 的對象都取到。 這里取到 4 個 對象。
此處的Html對應(yīng)
復(fù)制代碼 代碼如下:

<div class="first_div">
This is the first div
</div>
<div class="first_div">
<span class="first_span">
This is the first span
</span>
</div>
<span class="first_span eric_sun_class">
This is the first span + eric sun class.
</span>

復(fù)制代碼 代碼如下:

$(".first_div .first_span")

將以 .first_div 為類的控件 下的 以 .first_span 為類 的對象取到(類與類之間帶有空格 逐層?。?。 這里只取到 1 個。
對應(yīng)的 className="first_span" 此處的Html對應(yīng)
復(fù)制代碼 代碼如下:

<div class="first_div">
<span class="first_span">
This is the first span
</span>
</div>

復(fù)制代碼 代碼如下:

$(".first_span.eric_sun_class")

將包含有.first_span 并且同時包含有 .eric_sun_class 類的 對象取到(類與類之間沒有空格 類似于 ‘與' 操作)。 這里只取到1個。
對應(yīng)的 className="first_span eric_sun_class" 此處的Html 對應(yīng)
復(fù)制代碼 代碼如下:

<span class="first_span eric_sun_class">
This is the first span + eric sun class.
</span>

相關(guān)文章

最新評論

左云县| 莲花县| 雷波县| 庆云县| 安泽县| 阿巴嘎旗| 麻城市| 黄浦区| 安丘市| 神农架林区| 资中县| 宁远县| 上犹县| 定远县| 翼城县| 迭部县| 商丘市| 岱山县| 寿阳县| 白水县| 福安市| 南皮县| 湖南省| 西城区| 聂拉木县| 大悟县| 临潭县| 龙山县| 中宁县| 陆丰市| 永寿县| 通化市| 于都县| 镇远县| 元谋县| 开化县| 龙口市| 浦县| 镇巴县| 游戏| 上虞市|