-
<input type="button" value="AddList" onclick="addlist()"/> <h1>This is a Heading</h1> <p>This is a paragraph.</p> <lo id="list1"> LIST1 </lo> <script> function addlist() { l1 = document.querySelector("#list1"); e1 = document.createElement("li"); tn = document.createTextNode("createTextNode1"); e1.appendChild(tn); l1.insertBefore(e1, l1.childNodes[1]); } </script>
This is a Heading
This is a paragraph.
LIST1 'Html Css JavaScript' 카테고리의 다른 글
Javascript Eval (0) 2022.11.25 Javascript encodeUri decodeUri Component (0) 2022.11.25 예제 grid-template-gap box-shadow (0) 2022.11.24 Css GridTemplate box-shadow 그림자 만들기 (0) 2022.11.24 Javascript Node추가 - appendChild removeChild insertBefore (0) 2022.11.23 Javascript innerText & createTextNode 텍스트 추가 (0) 2022.11.23 Javascript Prompt 입력 값 얻기 (0) 2022.11.22 Javascript Math 함수 (0) 2022.11.22