第三章

在jQuery中,执行完mouse事件和mouseout事件后,都将返回当前的对象,所以可以进行链式操作
下列实例中就应用了链式操作为元素绑定事件:
在这里插入图片描述

<!DOCTYPE html>
<html>
	<head>
		<script type="text/javascript"  src="js/jquery-1.11.1.min.js"></script>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<img src="../jsp/1.jpg" width="1357" height="570" />
		<div style="float: right;text-align: right;">
			<a href="index.html">首页</a>
			&nbsp;| &nbsp;<a href="index.html"  class="main">登陆</a>
			&nbsp;| &nbsp;<a href="index.html"  class="main">注册</a>
			&nbsp;| &nbsp;<a href="index.html"  class="main">找回密码</a>
		</div>
		<script type="text/javascript">
		$(document).ready(function(){
			$("a.main").mouseover(function(){
				widow.status="http://www.mrbccd.com";return true;
			}).mouseout(function(){
				window.status="完成";return true;
			});
		});	
			</script>
	</body>
</html>

prev+next选择器 小小例子如下

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>

<script type="text/javascript"src="jquery-1.11.1.min.js"></script></head>
	
	<table width="98%"border="0"align="center"cellpadding="0"cellspacing="1"bgcolor="#CCEEFF">
    <tr>
		<td width="11%"height="27">编号</td>
		<td width="14%">祝福对象</td>
		<td width="12%">祝福着</td>
		<td witdh="33%">字条内容</td>
		<td width="30%">发送时间</td>
	</tr>
	<tr>
		<td height="27">1</td>
        <td>齐齐</td>
         <td>妈妈</td>
		 <td>愿你健康快乐成长</td>
		 <td>2011001-220</td>
		 </tr>
	</table>
	<style type="text/css">
		td{
			font-size: 12px;
			padding: 3px;
		}
		.th{
			background-color: aqua;
			font-weight: bold;
			text-align: center;
		}
		.even{
			background-color: blueviolet;
		}
		.odd{
			background-color: #F9FCEF;
		}
	</style>
	<script type<body>
	</body>
</html>

完善监测机制

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<div>检测这个页面</div>
		<script type="text/javascript">
			alert(document.getElementById("mr").value);
		</script>
	</head>
	<body>
	</body>
</html>

复合选择器

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript" src="jquery-1.11.1.min.js"></script>
		<p class ="default">P 元素</p>
		<div class="default">div 元素</div>
		<span class="default" id="span"> ID 为span元素</span>
		<input type="button" value="为div元素和ID为span的元素互换"/>
		<script type="text/javascript">
			$(document).ready(function(){
				$("input[type=button]")..click(function(){
					$("div,#span").addClass("change");
				});
			});
		</script>
	</head>
	<body>
	</body>
</html>

fuziling

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript" src="jquery-1.11.1.min.js"></script>

	
	</head>
<from id="forml" name="forml" method="post" action="">
	姓&nbsp;&nbsp;名:<input type="text" name="name" id="name"/>
	<br/>
	籍&nbsp;&nbsp;贯:<input name="native" type="text" id="native" />
	<br/>
	生&nbsp;&nbsp;日:<input type="text"name="birthday" id="birthday" />
	<br/>
	E-mail:<input type="text"name ="email"id="email"/>
	<br/>
	<span>
		<input type="button" name="change"id="change" value="换肤"/>
		
	</span>
	<input type="button"name="default" id="default" value="恢复默认"/>
	<br/>
	
</from>
<style type="text/css">
	input{
		margin:5px;
		
	}
	.input{
		font-size;12pt;
		color:#333333;
		background-color: #cef;
		border:1px solid #000000;
		
	}
</style>
<script type="text/javascript">
	$(document).ready(function(){
		$("#change").click(function(){
			$("form>input").addClass("input");
			
		});
		$("#default").click(function(){
			$("from>input").removeClass("input");
		});
		
	});
</script>
	<body>
	</body>
</html>

层次选择器

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript"src="jquery-1.11.1.min.js"></script>
		<div id="buttom">
			<ul>
				<li>技术服务热线:400-6451-44411 传真:0431-8972266 企业邮箱:mingrisofr@mingesido.com</li>
				<li>Copyright&copy;www.mrbccd.com All Right Reserved!</li>
				
			</ul>
		</div>
		<ul>
			<li>技术服务热线:400-675-1066 传真:0431-84972266 企业邮箱:mingrisoft@mingrisoft.com</li>
			<li>Copyright&copy;www.mrbccd.com All Right Reserved</li>
		</ul>
		<style type="text/css">
			#buttom{
				background-image;url(images/bg_bottom.jps);
				width:800px;
				height:58px;
				clear: both;
				text-align: center;
				padding-top: 10px;
				font-size: 9pt;
			}
			.copyright{
				color: #00FFFF;
			list-style: none;
			line-height: 30px;
			}
		</style>
		<script type="text/javascript">
			$(document).ready(function(){
				$("div ul").addClass("copyright");
			});
		</script>
	</head>
	<body>
	</body>
</html>

第三章知识点整理

jQuery选择器的优势:
代码更简单,支持css1到css3选择器,完善的监测机制
基本选择器
ID选择器(#id),
在这里插入图片描述
元素选择器(element),
在这里插入图片描述
类名选择器(.class),
在这里插入图片描述
复合选择器(selector1,selector2.selectorN),
在这里插入图片描述
通配符选择器(*),使用选择器隐藏超链接地址
在这里插入图片描述
层次选择器
ancestor descenda选择器,parent>child选择器,prev+next选择器,prev~siblings选择器
过滤选择器:
简单过滤器,

在这里插入图片描述内容过滤器,
在这里插入图片描述
可见性过滤器,

表单对象的属性过滤器,
在这里插入图片描述
子元素过滤器
在这里插入图片描述
属性选择器

在这里插入图片描述

表单选择器
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值