首页 技术 正文
技术 2022年11月21日
0 收藏 989 点赞 5,047 浏览 1773 个字

代码如下:

<%@
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> . 代码如下:$(“.first_div, .first_span”)

将包含有.first_div 或者 .first_span” 的对象都取到。 这里取到 4 个 对象。
此处的Html对应

. 代码如下:<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> . 代码如下:$(“.first_div .first_span”)

将以 .first_div 为类的控件 下的 以 .first_span 为类 的对象取到(类与类之间带有空格 逐层取)。 这里只取到 1 个。
对应的 className=”first_span” 此处的Html对应

. 代码如下:<div class=”first_div”>
<span class=”first_span”>
This is the first span
</span>
</div> . 代码如下:$(“.first_span.eric_sun_class”)

将包含有.first_span 并且同时包含有 .eric_sun_class 类的 对象取到(类与类之间没有空格 类似于 ‘与’ 操作)。 这里只取到1个。
对应的 className=”first_span eric_sun_class” 此处的Html 对应

. 代码如下:<span class=”first_span eric_sun_class”>
This is the first span + eric sun class.
</span>

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,964
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,486
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,331
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,114
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,747
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,781