<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style>
#box {
width: 100px;
height: 100px;
background: red;
}
</style>
</head>
<body>
<button id="btn">操控自己</button>
<div id="box"></div>
<script>
/*
1. 变量
2. 事件
3. 函数
4. 属性
*/
document.getElementById('btn').onclick = function () {
document.getElementById('btn').style.background = 'red';
document.getElementById("btn").style.width = '200px';
document.getElementById('btn').style.height = '200px';
document.getElementById('box').style.width = '500px'
}
</script>
</body>
</html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style>
#box {
width: 100px;
height: 100px;
background: red;
}
</style>
</head>
<body>
<button id="btn">操控自己</button>
<div id="box"></div>
<script>
/*
1. 变量
2. 事件
3. 函数
4. 属性
*/
document.getElementById('btn').onclick = function () {
document.getElementById('btn').style.background = 'red';
document.getElementById("btn").style.width = '200px';
document.getElementById('btn').style.height = '200px';
document.getElementById('box').style.width = '500px'
}
</script>
</body>
</html>