Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- Spring
- struts2
- AWT
- JavaScript
- 에러페이지
- 메서드
- layout
- Eclips
- 예외처리
- 이클립스
- 오버로딩
- 기본
- mybatis
- 배열
- Android
- oracle
- 메소드
- 생성자
- 안드로이드
- paint
- 국제화
- 전화걸기
- Graphic
- 클래스
- Menu
- JSP
- HTML
- Java
- 어노테이션
- OGNL
Archives
- Today
- Total
note
이벤트 발생 객체의 스타일 변경 본문
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script>
window.onload = function () {
document.getElementById('header').onclick = function(){
this.style.color = 'Orange';
this.style.backgroundColor = 'Red';
};
};
</script>
</head>
<body>
<h1 id="header">Click</h1>
</body>
</html>
클릭을 하면 스타일이 변경됨
this라는것은 가변적
이벤트가 일어나지 않았기 때문에 이벤트가 일어나는 순간 this가 값을 갖게됨
'JavaScript > 기본' 카테고리의 다른 글
| 이벤트 연결 (0) | 2012.03.19 |
|---|---|
| 이벤트 객체 (0) | 2012.03.16 |
| 이벤트 핸들러 안에서 this 키워드 (0) | 2012.03.16 |
| 이벤트 용어 (0) | 2012.03.16 |
| 현재 시간 표시 (0) | 2012.03.16 |