<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
body {
font-family: "Microsoft YaHei", serif;
}
body, dl, dd, p, h1, h2, h3, h4, h5, h6 {
margin: 0;
}
ol, ul, li {
margin: 0;
padding: 0;
list-style: none;
}
img {
border: none
}
#btn{
margin: 200px auto;
width: 200px;
height: 50px;
background-color: lawngreen;
text-align: center;
line-height: 50px;
font-weight: bolder;
user-select: none;
cursor: pointer;
}
</style>
</head>
<body>
<div id="btn">按钮</div>
<script>
var oBtn = document.getElementById("btn");
var index = 0;
arr = ["lawngreen","aqua","fuchsia"];
oBtn.onclick = function () {
index++;
this.style.backgroundColor = arr[index%3];
}
</script>
</body>
</html>
Python3Turtle