返回javascr......登陆

javascript控制div的样式

小邓2019-01-24 15:15:58206

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta http-equiv="X-UA-Compatible" content="ie=edge">

<title>Javascript控制div的样式</title>

<style>

#box{

width:100px;

height:100px;

background-color:lightblue;

}

</style>

</head>

<body>

<div id="box"></div>

<script>

document.getElementById('box').onclick = function() {

this.style.backgroundColor = 'orange';

this.style.borderRadius = '50%';

}

</script>

</body>

</html>


最新手记推荐

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

全部回复(0)我要回复

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