點擊出現div

在博客上找有些知識可真是太難了TAT

下面看實現的代碼

<html>
	<head>
		<script>
			function a() {
				var div = document.getElementById("d1");
				div.style.display = "block";
			}
		</script>
	</head>
	<body>
		<div id="d1" style=
		"display:none;
		width:500px;
		height:100px;
		border:1px solid;
		">
		我是出現的內容
		</div>
		<div>
		    <button type = "button" onclick="a()">點擊出現</button>
		</div>		
	</body>
</html>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章