오픈소스웹소프트웨어 Javascript DOM
p.6
DOM
Document Object Model
트리형식으로 표현하는 것
content까지 노드가 된다
p.8
document, methods, property
document.getElementById("demo").innerHTML="Hello World";
document, methods, property
시작할때 document.으로 시작한다
중요
시험은 소스코드를 주고
결과화면이 어떻게나올지 적어보세요 라고 나온다
getElementByID -> return only one element
getElementByTagName -> return several elements
p.14
return an HTMLCollection object
HTMLCollection object is an array-like list(collection) of HTML elements
length사용가능
However HTMLCollection is not array
because you cannot use array methods like Valueof(), pop(), push()
p.15
querySelectorAll
css selector로 접근
id,name,class universal, attribute, pseudo-class ...
p.16
querySelectorAll() method returns a NodeList
NodeList object is an array-like list(collection) of HTML elements
HTMLCollection vs NodeList
비슷한데 차이가 있다
htmlcollection is a collection of documents elements
can be accessed by name,id,index number
nodelist is a collection of document nodes
can be accessed only by index number
p.18
innerHTML은 contents다
how to access body?
document.body
p.19
innerHTML
access contents of HTML element
p.22
document.getElementById(id).attribute=new value;
p.23
document.getElementById(id).value=new value;
p.33
document.createTextNode("Water");
p.39 시험에나오면안될거같아요
p.40
event name, content of event