DOM children方法

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>DOM children方法</title>
	</head>
	<body>
		<div id="div1">
			<p id="pid">p标签</p>
		</div>
		<script type="text/javascript">
			var div1=document.getElementById("div1");
			var first=div1.children[0];
			console.log("first.nodeName="+first.nodeName);//first.nodeName=P
			console.log("first.innerHTML="+first.innerHTML);//first.innerHTML=p标签	
		</script>
	</body>
</html>

  

posted on   -小神飞  阅读(165)  评论(0编辑  收藏  举报

努力加载评论中...

导航

点击右上角即可分享
微信分享提示