getElementById()
html, css의 구문에 변화를 줄수 있다.
Id기반.
<p id="demo">JavaScript can change HTML content.</p>
<button type="button" onclick='document.getElementById("demo").innerHTML = "Hello JavaScript!"'>Click Me!</button>
demo라는 Id를 가진 녀석의 innerHTML을 Hello~ 로 바꿔라...
<img id="myImage" src="pic_bulboff.gif" style="width:100px">
<button onclick="document.getElementById('myImage').src='pic_bulboff.gif'">Turn off the light</button>
myImage라는 Id를 가진 녀석의 src속성을 pic~로 바꿔라...
이렇게 사용;;