JavaScript-2.2 document.write 输出到页面的内容

<html>
	<head>
		<meta http-equiv="content-type" content="text/html;charset=GB2312"/>
		<title> 2-4 使用document.write经内容输出到页面 </title>
		<!--脚本部分-->
		<script type="text/javascript">
			document.write("你好");
			document.write("<br><b>能够输出HTML</b>");
			</script>
	</head>
	<body style="overflow:auto;">
		<input type="button" value="点我" 
		  onclick="document.write('在页面载入完毕后再次使用docement.write会清空原来的全部内容');"/>
		</body>
</html>



执行结果:




原文地址:https://www.cnblogs.com/mengfanrong/p/4083673.html