📌  相关文章
📜  使用 javascript 代码示例更改正文背景颜色

📅  最后修改于: 2022-03-11 15:04:11.238000             🧑  作者: Mango

代码示例4
function btn() {
        event.stopPropagation();
      }

      var button = document.getElementById("btn");
      button.addEventListener("click", function (e) {
        e.target.style.backgroundColor = "green";
      });
      button.addEventListener("focusout", function (e) {
        e.target.style.backgroundColor = "";
      });