返回JS改变DIV......登陆

JS改变DIV样式

Dusk2019-05-04 23:04:27306

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title></title>

<style type="text/css">

#box{

height: 100px;

width: 100px;

background-color: deeppink;

}

</style>

</head>

<body>

<div id="box">

</div>


<input type="button"  value="改变高度"onclick="aa()" />

<input type="button"  value="改变宽度"onclick="bb()"  />

<input type="button"  value="改变颜色" onclick="cc()" />


<script type="text/javascript">

var box

window.onload=function(){

box = document.getElementById("box")

}

function aa(){

box.style.height = "400px"

}

function bb(){

box.style.width= "400px"

}

function cc(){

box.style.backgroundColor = "blue"

}

</script>


</body>

</html>


最新手记推荐

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

全部回复(0)我要回复

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