본문 바로가기
반응형

study/JavaScript11

project - hover animation(텍스트에 마우스 올리면 배경이 이미지로 바뀜) - HTML - Hover over the links But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will freedom you a account of the system, and expound the actual teachings of the great of the truth, travel master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is, but explore those who do not know how to pursue.. 2020. 6. 5.
함수 객체 *자바스크립트에서는 함수로 객체다. 함수의 기본 기능이 코드 실행뿐 아니라, 함수 자체가 일반 객체처럼 프로퍼티들을 가질수 있다. // 함수 선언 방식으로 add()함수 정의 function add(x, y) { return x + y; } // add() 함수 객체에 result, status프로퍼티 추가 add.result = add(3, 2); add.status = "OK"; console.log(result); //5 console.log(status); //"OK" 위처럼 함수 선언문 방식으로 add() 함수를 생성 후, 일반 객체처럼 result와 status 프로퍼티를 추가하는게 가능 add() 함수를 생성할 때 함수 코드는 함수 객체의 [[Code]] 내부 프로퍼티에 자동 저장 add().. 2020. 5. 25.
Event - click 이벤트, mouseenter, mouseleave 이벤트 *많이 쓰는 Event 종류 이벤트 명 설명 click 클릭시 발생 change input 요소의 변동이 있을 때 mouseover 마우스가 특정 객체 위에 올려졌을 때 mouseout 마우스가 특정 객체 밖에 나갔을 때 mouseenter 마우스가 특정 객체 안에 들어왔을 때 mouseleave 마우스가 특정 객체에서 떠났을 때 *click html의 button태그에 있는 id명 submit에 적용. 문법 btn.addEventListener('click', function(){ }); --------------------------------------------- var btn = document.getElementById('submit'); btn.addEventListener('click', .. 2020. 5. 10.
스타일 변경하기 *요소가 하나일때 문법 변수명.style.color = '색상'; ---------------------------------------------------- 활용 var firstTitle = document.getElementById('title'); firstTitle.style.color = 'red'; *요소가 배열일때 (다수) - 반복문 사용 html에 paragraph가 다수가 있을경우 console.log로 확인해 보면 배열로 나온다. var paragraphs = document.getElementsByTagName('p'); console.log(paragraph); //콘솔 값 HTMLCollection [ 0: p, 1: p, 2: p, 3: p, length: 4 ] ------.. 2020. 5. 10.
반응형