修改元素过程

 

 

  <style>
    div {
      width: 300px;
      height: 30px;
      line-height: 30px;
      color: #fff;
      background-color: pink;
    }
  </style>
  <body>
    <button id="btn">显示当前时间</button>
    <div id="div">某个时间</div>
    <script>
      var a = document.getElementById("btn");
      a.onclick = function () {
        div.innerText("123");
        var a = prompt("1231");
        div.style.backgroundColor = "red";
        div.style.width = "500px";
        div.style.height = "500px";
      };
    </script>

 

posted @ 2022-04-18 11:02  罗砂  阅读(37)  评论(0)    收藏  举报