실제 예제
<html> <head> <meta http-equiv="Content-Type" content="text⁄html; charset=EUC-KR"> <style> .reverse{ background: Black; color: White; } <⁄style> <script src="http:⁄⁄code.jquery.com⁄jquery-1.7.js"><⁄script> <script> $(document).ready(function() { ⁄⁄이벤트를 연결함 $('h1').bind('click',function(){ ⁄⁄bind 는 함수를 모아놓은 것 클릭할때 $(this).html(function (index,html){ return html +'*'; ⁄⁄ * 가 하나씩 추가됨 }); }); $('h1').bind({ ⁄⁄이벤트를 연결함 mouseenter:function (){ $(this).addClass('reverse');}, mouseleave:function (){ $(this).removeClass('reverse');} }); }); <⁄script> <⁄head> <body> <h1>Header-0<⁄h1> <h1>Header-1<⁄h1> <h1>Header-2<⁄h1> <⁄body> <⁄html>
결과 화면
'JavaScript&Web' 카테고리의 다른 글
[JavaScript] 동적 table 행 추가 (0) | 2013.05.30 |
---|---|
[Javascript] 빈칸체크하기 간단예제 (0) | 2013.05.21 |
[JavaScript] innerHTML 활용 예제 (0) | 2013.03.31 |
[JavaScript] jquery를 가지고 css 주기 (0) | 2013.03.31 |
[JavaScript] Java 와 JavaScript 는 무엇이 다른걸까? (0) | 2013.03.29 |