<html>
<body>
Enter your name: <input type="text" onfocusin="myFunction(this)">
<p>When the input field gets focus, a function is triggered which changes the background-color.</p>
<script>
function myFunction(x) {
x.style.background = "yellow";
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onfocusin by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 05 Jun 2019 14:04:33 GMT -->
</html>