返回DIV点击事件...登陆

DIV点击事件

夜半钟声2019-05-08 23:37:06373
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>changeDIV</title>
<style>
#box{width:100px;height:100px; background:red; margin:10px 80px;}
</style>
</head>
<body>
<script type="text/javascript">
	var box
	window.onload = function(){
		box = document.getElementById('box')	
	}
	//高度
	function h(){
		box.style.height = "300px"
	}
	//宽度
	function w(){
		box.style.width = "300px"
	}
	//颜色
	function b(){
		box.style.background = "#09F"
	}
	function d(){
		box.style.height = "100px"
		box.style.width = "100px"
		box.style.background = "red"
	}
	function e(){
		box.style.display = "none"
	}
	function f(){
		box.style.display = "block"
	}
</script>
<div id="box"></div>
<input type="button" value="变高" onClick="h()">
<input type="button" value="变宽" onClick="w()">
<input type="button" value="变色" onClick="b()">
<input type="button" value="重置" onClick="d()">
<input type="button" value="隐藏" onClick="e()">
<input type="button" value="显示" onClick="f()">
</body>
</html>


最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送