JavaScript 中 onfocusin 事件的用法是什麼?


onfocusin 事件在元素獲取焦點時觸發。你可以嘗試執行以下程式碼,瞭解如何在 JavaScript 中實現onfocusin 事件 −

示例

<!DOCTYPE html>
<html>
   <body>
      <p>Write below:</p>
      <input type="text" onfocusin="newFunc(this)">
      <script>
         function newFunc(x) {
            x.style.background = "blue";
         }
      </script>
   </body>
</html>

更新於: 2020-06-23

131 次瀏覽

開啟你的職業生涯

完成課程獲取認證

開始學習
廣告
© . All rights reserved.