亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

通過button改變CSS的樣式

Original 2018-12-14 12:08:23 258
abstract:<!DOCTYPE html> <html> <head> <title>ChangeDIV</title> <style type="text/css"> #box{width: 100px;height: 100px;background: re
<!DOCTYPE html>
<html>
<head>
	<title>ChangeDIV</title>
	<style type="text/css">
		#box{width: 100px;height: 100px;background: red;margin: 20px 80px;}
	</style>
</head>
<body>
	<div id="box"></div>
	<input type="button" value="變高" onclick="high()">
	<input type="button" value="變寬" onclick="wdth()">
	<input type="button" value="變色" onclick="clor()">
	<input type="button" value="重置" onclick="rest()">
	<input type="button" value="隱藏" onclick="hid()">
	<input type="button" value="顯示" onclick="show()">
	<script type="text/javascript">
		var box
		window.onload=function(){
			box=document.getElementById('box')
		}
		function high () {
			box.style.height="400px"
		}
		function wdth () {
			box.style.width = '400px'
		}
		function clor () {
			box.style.background = 'pink'
		}
		function rest () {
			box.style.height = '100px'
			box.style.width = '100px'
			box.style.background = 'red'
		}
		function hid () {
			box.style.display = 'none'
		}
		function show () {
			box.style.display = 'block'
		}
	</script>
</body>
</html>


Correcting teacher:滅絕師太Correction time:2018-12-14 13:13:48
Teacher's summary:小案例比較簡單,自己可以嘗試一些其他案例,鞏固學(xué)習(xí)奧!

Release Notes

Popular Entries