목록WEB/JavaScript (51)
Jam's story
//Function() 객체 생성자 -F를 대문자로 써야한다. var myHap=new Function("a","b","return a+b"); document.write(myHap(19,2)+" "); //자체호출함수 (function (){ })(); ex03.html 1. js function(함수) 정리 *** 2. js 함수 closures( 클로저 ) ***
1.[ 이벤트 버블링 ] 자식=>부모 자식요소 이벤트가 발생하면 부모요소에 그 이벤트가 전달(전파) 2. 이벤트 캡처링 부모=>자식 부모요소 이벤트가 발생하면 자식요소에 그 이벤트가 전달(전파) event.cancleBubble=true; => 이벤트 버블링 취소 ex02.html 1.이벤트 버블링 자식요소 이벤트가 발생하면 부모요소에 그 이벤트가 전달 2.이벤트 캡쳐링 부모요소 이벤트가 발생하면 자식요소에 그 이벤트가 전달 이벤트버블링체크 자식p태그 클릭
// 1. document.getElementById(id) // 2. document.querySelector("h1"); // 3. document.getElement[s]ByClassName(name) // 4. document.getElement[s]ByName(name) /* document.getElementsByTagName("h1")[0].onclick = function (){ alert("test") } */ // removeEventListener() 이벤트 등록 취소 /* document.getElementsByTagName("h1")[0].addEventListener("click", function(e) { alert("XXX"); }); */ $("h1").click(funct..
ex02.html //js Set //js Map //key- value ,한쌍 entry //1.new Map() //2.set()/ get() /delete()/ for each /size //3.entries() map.html for(let entry of fruits.entries()){ console.log(entry); } for(let entry of fruits){ console.log(entry); } //두개 다 가능하다. .entries()안써도 가능
ex13.html 스크롤 표시하기 Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellat praesentium ex animi eos in excepturi quod? Quas a commodi labore quidem nihil ipsum reiciendis. Eum quisquam laboriosam modi impedit ipsam iste consectetur. Minima accusantium architecto minus ex odit exercitationem similique. Modi dolores quo ipsa voluptate eius ratione eum! Rem vel tempora repudiandae quod c..
ex12_03.html TypeWriter 한문자씩 읽어오기
ex11.html ex11.html -call()/apply() [ call()] 다른 객체의 메소드를 call 불러서 처리 ex11.html ex11.html -call()/apply() [ call()] 다른 객체의 메소드를 call 불러서 처리