일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
- Unity
- 코딩
- 아두이노
- 스크래치
- Spring Security
- 라즈베리파이
- jsp
- html5
- 예제
- 운정
- 시작하기
- 강좌
- 톰캣
- 안드로이드
- jobtoy
- MSSQL
- 설치
- s4a
- 파주
- 오라클
- 유니티
- Android
- mysql
- 리브레캐드
- librecad
- tomcat
- 잡토이 메이킹 코딩 학원
- 설정
- oracle
- 잡토이
- Today
- Total
랩제이
자바스크립트 class화 하기 본문
* test.js
var act = {}; // act.calendar 패키지 정의
// 현재 년,월,일,span id, text id, 보기(안보기)
act.calendar = function(calDivId, spanId, textId) {
this.calDivId = calDivId; //달력영역
this.spanId = spanId; //달력 보이는 부분
this.textId = textId; //날짜 입력 될 text
}
act.calendar.prototype = {
test: function() { // 자바스크립트 날짜 객체
return this.calDivId+'-'+this.spanId+'-'+this.textId;
},
currentDay: function() { // 자바스크립트 날짜 객체
var today = new Date();
return today;
}
}
* index.jsp
<%@ page contentType="text/html; charset=euc-kr" %>
<html>
<script type="text/javascript" src="./js/prototype.js" />"></script>
<script type="text/javascript" src="./js/test.js" />"></script>
<script language="JavaScript">
window.onload = function() {
logout();
}
function logout(){
var calendar = new act.calendar(1, 2, 3);
var calendar1 = new act.calendar(11, 12, 13);
var calendar2 = new act.calendar(21, 22, 23);
alert(calendar.test() + calendar1.test() + calendar2.test());
}
</script>
<body>
</bodY>
</html>
'programming > jsp' 카테고리의 다른 글
서블릿 테스트 (0) | 2012.03.21 |
---|---|
prototype & scriptaculous 인 액션 3장 예제 (0) | 2012.03.21 |
jsp로 xml문서 만들기 (0) | 2012.03.21 |
Prototype - A$() 함수 (0) | 2012.03.21 |
이미지보여주기 - lightbox (0) | 2012.03.21 |