<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Document</title>
<style type="text/css" media="screen">
#canvas{
width: 100%;
height: 500px;
}
ul li{
list-style: none;
float: left;
}
li:nth-of-type(1){
background: red;
color: white;
}
li:nth-of-type(2){
background: green;
color: white;
}
li:nth-of-type(3){
background: blue;
color: white;
}
</style>
</head>
<body>
<div id="canvas"></div>
<ul>
<li>红色</li>
<li>绿色</li>
<li>蓝色</li>
</ul>
<script type="text/javascript">
var canvas = document.getElementById("canvas");
var ul = document.g
点击li背景发生变化
最新推荐文章于 2022-09-15 17:06:25 发布