x
 
<!DOCTYPE html>
<html>
<body>
    <form>
      Enter name: <input type="text" id="name" />
    </form>
    <script>
        var time = window.setTimeout(function(){timer()}, 3000);
        function timer(){
            document.getElementById("name").style.backgroundColor = "red"; 
            alert("Time to input is over");
        }
    </script>
</body>
</html>