<script> // className can operate the class name, defects: there will be overwriting problems when setting the class name // H5 provides a classList class name collection with methods available var box = document.querySelector ("# box" ); // console.dir (box); // classList.add method ==> add class name // classList.remove method ==> delete class name // classList.contains method ==> determine whether there is an included class name, and return if there is true. Otherwise, return false // classList.toggle method ==> switch class name (remove if there is, add if not) // add ff // box.classList.add ("ff"); // box.className = "aa bb cc ff"; // box.classList.remove ("bb"); // console.log (box.classList.contains ("cc"));