jquery初学

<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("p").click(function(){
  $("p").css("background-color","red");  //改变 HTML 元素的 CSS 属性
  $(this).hide(); 
  });
  $("button").click(function(){
   $("#f").hide();
   });
});
</script>

</head>
<body>
hello
<p>If you click on me, I will disappear.</p>
<button id="f">hide</button>

</body>
</html>

posted on 2012-04-21 12:49  笑靥  阅读(101)  评论(0编辑  收藏  举报