getElementById

첫번째 문장

"> 08-02_getElementByid

getElementById

첫번째 문장

"> 08-02_getElementByid

getElementById

첫번째 문장

">
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>08-02_getElementByid</title>
<script type="text/javascript">
	/*
		# getElementByid()
		- html 요소중 지정한 id 요소를 선택.
	*/
</script>
<style type="text/css">
body {
	font-size: 24px;
}
p {
	background-color: orange;
	color: blue;
}
span {
	color: red;
}
</style>
</head>
<body>
	<h1 id="title">getElementById</h1>
	<p id="first_p" onclick="this.style.color='green'">
	<span>첫번째 문장</span>
	</p>
	<script type="text/javascript">
		let title = document.getElementById('title');
		document.write('<p>title : ' + title + '</p>');
		
		let p = document.getElementById('first_p');
		let text = 'p.id : ' + p.id + '<br/>';
		text += 'p.tagName : ' + p.tagName + '<br/>';
		text += 'p.childElementCount : ' + p.childElementCount + '<br/>';
		text += 'p.onclick : ' + p.onclick + '<br/>';
		document.write(text);
	</script>
</body>
</html>