여기서 jquery-1.4.4.js 받고
프로젝트에 js 폴더 만들고복사
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
//jquery-1.4.4.min.js 파일 불러오기
<title></title>
<style type="text/css">
*{padding:0px;margin:0px;}
body{text-align:center;}
div{text-align:left;width:500px;margin:20px auto;}
div p{background:#666666;}
h3{background:#999999;}
address{position:absolute;bottom:0px;left:0xp;}
</style>
</head>
<body>
<div id="hello">Hello World!</div>
<div id="first">
<h3><a href="#">aaa</a></h3>
<p>웹 프로그래밍.</p>
<h3><a href="#">bbb</a></h4>
<p>목록 테스트</p>
</div>
<script type="text/javascript">
$(document).ready(function() // 문서 올라올 때 실행
{
$("#hello").click(function() // hello라는 이름의 div 클릭 할 때
{
$(this).hide(); // hello div를 숨겨라
});
$("#first h3").toggle // first div의 h3 toggle, 인수 두개
(
function(e){e.preventDefault(); $(this).next().slideUp();},
// 목록 접기
function(e){e.preventDefault(); $(this).next().slideDown();}
// 목록 내리기
);
});
</script>
//jQuery 끝
</body>
</html>
.
댓글 없음:
댓글 쓰기