WEB.JS/08.DOM_JS

chapter06 : DOM_getElementById

GAWON 2023. 5. 23. 09:15
<!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>