<p id="mo">모</p> <p class="gak">각</p> <p>코</p> <button onclick="changeText1()">모</button> <button onclick="changeText2()">각</button> <button onclick="changeText3()">코</button> <script src="3.js"></script>
//자바스크립트 function changeText1(){ var mo = document.getElementById("mo"); mo.innerHTML="모처럼이니"; } function changeText2(){ var gak = document.getElementsByClassName("gak"); gak[0].innerHTML="각잡고 열심히 하면"; } function changeText3(){ var co = document.getElementsByTagName("p"); co[2].innerHTML="코린이 탈출이다"; }