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>