onfocusin 事件在 JavaScript 中有什麼用?
當一個元素獲得焦點時,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>
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
JavaScript
PHP