WON.dev
chapter06 : DOM_getElementById 본문
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
```
onload = function(){
var seasons = ["spring","summer","fall","winter"];
var list = "";
var len = seasons.length;
list +="<ul>";
for(var i=0, len = seasons.length; i < len; i++){
list += "<li>";
list += seasons[i];
list += "</li>";
}
list +="</ul>"
document.getElementById("ex").innerHTML = list;
}
```
</script>
</head>
<body>
<div id="ex"></div>
</body>
</html>
'WEB.JS > 08.DOM_JS' 카테고리의 다른 글
chapter04 : DOM생성 (0) | 2023.05.23 |
---|---|
chapter05 : DOM삭제 (0) | 2023.05.23 |
chapter07 : DOM_getElementsByTagName (0) | 2023.05.22 |
chapter08 : DOM_getElementsByClassName (0) | 2023.05.22 |
chapter09 : DOM_querySelector (0) | 2023.05.22 |