返回 改变DIV样式... 登陆

改变DIV样式

**秒创 2018-11-27 00:43:21 250
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>改变DIV样式</title>
<style type="text/css">
#div1{height: 200px;width: 200px;background: red;margin: 20px 50px;}
</style>
</head>
<body>
<div id="div1"></div>
<input type="button" value="变高" onclick="aa()">
<input type="button" value="变宽" onclick="bb()">
<input type="button" value="变色" onclick="cc()">
<input type="button" value="重置" onclick="dd()">
<input type="button" value="隐藏" onclick="ee()">
<input type="button" value="显示" onclick="ff()">
<script type="text/javascript">
var div1
window.onload=function () {
div1=document.getElementById('div1');
}
function aa() {
    div1.style.height="450px";
}
function bb() {
div1.style.width="400px";
}
function cc() {
div1.style.background="#ccc";

}
function dd() {
div1.style.height="200px";
div1.style.width="200px";
div1.style.background="red";
}
function ee() {
div1.style.display="none";
}
function ff() {
div1.style.display="block";
}
</script>

</body>
</html>


最新手记推荐

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

全部回复(0)我要回复

暂无评论~
  • 取消 回复 发送
  • PHP中文网