jquery复习笔记1 - ready() show() hide() toggle()

来源:互联网 发布:tw域名要翻墙吗 编辑:程序博客网 时间:2024/05/29 10:12
<%@ 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 'index.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" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script><script type="text/javascript">$(document).ready(function(){$("#b1").click(function(){$("p").hide();});$("#b2").click(function(){$("p").show();});});</script>  </head>    <body>    This is my JSP page. <br>    <p>我将被隐藏掉</p>    <button id="b1">隐藏</button>    <button id="b2">显示</button>  </body></html>


心得:可在$(document).ready();方法中进行方法的绑定,比如给按钮绑定某些事件。

0 0
原创粉丝点击