HTML DOM 操作-创建节点【2018.11.26】

<!DOCTYPE html>
<html lang="en">
<head>
	<title>hello world</title>
</head>
<body>
	<script type="text/javascript">
		var op =document.createElement('p');
		var body = document.getElementsByTagName('body');
		op.innerHTML = 'hello world';
		body[0].appendChild(op);
	</script>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/weixin_30589127/article/details/84543262