JQuery 第三章 初始JQuery 上机+课后

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <script type="text/javascript" src="js/jquery-1.11.1.js"></script>
    <title>My JSP 'sj7.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript">
	
	
  $(document).ready(function(){
	
	$("h1").click(function(){
	$("h1").css("color","pink").next().css("display","block")
	$("li").addClass(".first").css("color","red");
	
	     });
	  });
	  
	$(function(){
	var ls=$("li");
	ls.mouseover(function(){
	$(this).css("background","blue");
	
	});
	
	ls.mouseout(function(){
	$(this).css("background","");
	});
	
	});
	
	
	
	</script>
<style type="text/css">
        #list{
            width: 200px;
            height: 200px;
            border: 1px solid red;
        }
	
	#list{padding:5px;}
	#list1{display:none;}
      </style>

  </head>
  
  <body> 
  <div id="list"><h1>新手指南</h1>
  <div id="list1"><ul>
                  <li id=".first">会员注册</li>
                  <li>订阅更新</li>
                  <li>用户协议</li>
                  <li>常见问题</li>
                  </ul>
                   </div>
                   </div>
  </body>
</html>

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'kh4.jsp' starting page</title>
     <script type="text/javascript" src="js/jquery-1.11.1.js"></script>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript">
	$(document).ready(function(){
	alert("学习JQuery编程,我已卖出了第一步");
	});
	</script>

  </head>
  
  <body>
 
  </body>
</html>


	alert("我编写的第一个JQuery程序!!!");
	});
	</script>

  </head>
  
  <body>
  
  </body>
</html>

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'sj2.jsp' starting page</title>
     <script type="text/javascript" src="js/jquery-1.11.1.js"></script>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript">
	$(document).ready(function(){
	
	$("h1").click(function(){
	$("p").css("font-size","12px");
	$("p").css("color","pink");
	$("h1").css("font-size","36px");
	$("h1").css("color","red");
	$("#ha").css("padding","10px");
	var height=null;
   height=$(this).height();
  $(this).height("60");
	         });
	});
	</script>

  </head>
  
  <body>
  <div id="ha">
  <h1>你是人间的四月天</h1>
  <p>笑响亮了四面风</p>
  <p>轻灵在春的光艳中交舞着变</p>
  <p>你是四月早天里的云烟</p>
  <p>黄风吹着风的软</p>
 <div id="xs()">
 </div>
 
 <img src="img/0.jpg"></img>
 
 </div>
  </body>
</html>

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'sj3.jsp' starting page</title>
     <script type="text/javascript" src="js/jquery-1.11.1.js"></script>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript">
	$(document).ready(function(){
	
	$("#dj").click(function(){
	$(this).css("border","3px solid red"); 
	
	});
	});
	</script>
<style> 
#box a{ display:block; z-index:1000; width:449px; height:399px;} 
</style> 
  </head>
  
  <body>
  
  <div id="box" style="width:451px; height:401px;">
  <img id="dj" src="img/s.jpg" width="450px" height="400px" ></img>
    </div>
  </body>
</html>

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'sj4.jsp' starting page</title>
     <script type="text/javascript" src="js/jquery-1.11.1.js"></script>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript">
	$(document).ready(function(){
	
	$("h1").click(function(){
	$("h1").css("background-color","pink").next().css("display","block");
	
	
	});
	});
	</script>
	<style type="text/css">
	
	h1{padding:5px;}
	ul{display:none;}
	</style>
  </head>
  
  <body>
  <h1>如何使用叮当网购物</h1>

  <ul>
  <li>方法一:注册成为网站会员</li>
  <li>方法二:使用合作企业账号登录,如新浪微博,QQ,人人网账户</li>
  </ul>

  </body>
</html>

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'sj5.jsp' starting page</title>
    <script type="text/javascript" src="js/jquery-1.11.1.js"></script>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript">
	$(document).ready(function(){
	
	$("h1").click(function(){
	
	$(function(){
var dom=document.getElementById("my");

var str=$(dom).text();
alert(str);

});
	
	});
	});
	</script>
	<style type="text/css">
	#my{display:none;}
	</style>
  </head>
  
  <body>
   <h1>请为我们的服务做出评价</h1>
   <div id="my">非常满意</div>
  </body>
</html>

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'sj6.jsp' starting page</title>
    <script type="text/javascript" src="js/jquery-1.11.1.js"></script>
	
	
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript"> 
	//$(document).ready(function(){
	$(function(){
	$("#all").click(function(){
	
	var dom=document.getElementById("all");
	if (dom.checked) {
     alert('操作成功,感谢你的使用');}
     });
     });




	//});
	</script>

  </head>
  
  <body>
  
  <input  id="all"  type="checkbox" value="5"/>
  <a>接收服务条款</a>
 
  </body>
</html>

(答案见下载资源) 上机任务1 用chrome打开dom.sample2.html页面, 在chrome的控制台中输入jQuery代码并执行,完成以下选择动作: (1)查找id号为tigerLily的元素 (2)查找拥有类myList的元素 (3)查找所有的input元素 (4)查找所有img元素和tr元素 (5)查找id号为coffeePot和id号为someDiv的元素 (6)选择具有id属性的所有元素 (7)选择具有id属性的input元素 (8)选择其value属性等于A的元素 (9)选择其value属性等于A或等于C的元素 (10)选择其title属性值中含有dog的img元素 (11)选择其href属性值以http开头的a元素 (12)选择div元素内嵌套的span元素 上机任务2 用chrome打开dom.sample2.html页面, 在chrome的控制台中输入jQuery代码并执行,完成以下选择动作: (13)选择元素li,该元素作为拥有myList类的ul元素的直接子元素 (14)选择id号为radioA的input元素后面的第一个input兄弟元素 (15)选择id号为radioA的input元素后面的所有input兄弟元素 (16)选择dom sample页面中第3个tr元素 (17)选择其type属性值checkbox且索引为偶数的input元素 (18)选择非最后一行的tr元素 (19)选择所有的checkbox元素 (20)选择所有被选中的表单元素 (21)选择含有1972的td元素 (22)选择包含有sapn元素的div元素 (23)选择表格中每行的第一个单元格和最后一个单元格 (24)选择表格中第3行,标题行不算(要求用nth-child()过滤器) 上机任务3 用chrome打开dom.sample2.html页面,该页面中内嵌有几个CSS类:.red .green .blue .yellow .thickBorder .seeThrough 在chrome的控制台中输入jQuery代码并执行,完成以下选择动作: (1)将拥有alt属性的倒数第二个图片元素应用yellow类 (2)将第一个checkbox表单元素应用.green样式 (3)求id值为checkbox3的元素在所有表单元素里的顺序号 (4)用一条链式语句完成:先对所有img元素应用seeThrough样式,再为所有img元素和tr元素应用yellow样式 (5)用filter方法实现:选择单元格内容为Java或Smalltalk的单元格 (6)取图片集中的第2,3,4张图片 (7)用has方法实现:选择那些包含有ul元素的li元素 (8)将tbody每个单元格里的文字设为:我爱jQuery (9)查找form元素的后代元素中标签为label的元素 (10)查找表单元素中是否有id值为checkbox5的元素 提示: 为某dom元素应用某css样式可以使用jQuery中的addClass方法,例如:将id为tt的div元素应用.bt样式,可用些语句:$("#tt").addClass("color","red");
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值