1. DIV 크기 구하기(동적) - 더블클릭시
<!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> jquery </title>
<style>
#my{background-color:yellow}
</style>
<script src="http://code.jquery.com/jquery-1.7.2.js"></script>
<script>
$(document).ready(function (){
//
$("#btn").dblclick(function(){
var msg = $("#my").width() + ", " + $("#my").height();
window.alert(msg);
});
});
</script>
</head>
<body>
<div id="my">
<p>jQuery</p>
<p>Ajax</p>
</div>
<input type="button" id="btn" value="위 영역의 크기 구하기" />
</body>
</html>
'강좌 > jQuery' 카테고리의 다른 글
jQuery효과 관련 API (0) | 2013.04.23 |
---|---|
제이쿼리(jQuery) - API(동적으로 다른 이벤트 호출) 와 live, delegate함수 비교 (0) | 2013.04.23 |
제이쿼리(jQuery) - 조작 함수(manipulate) (0) | 2013.04.23 |
제이쿼리(jQuery) - DOM요소의 앞/뒤에 요소 추가 (0) | 2013.04.23 |
제이쿼리(jQuery) Manipulation API (0) | 2013.04.23 |