Redirect all keyboard input to a textbox dynamically - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Text

Description

Redirect all keyboard input to a textbox dynamically

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*  w  w  w . jav a 2 s .  c  om*/
function inputFocus(){
          document.getElementById("inputField").focus();
}
window.onkeydown = inputFocus;
    }

      </script> 
   </head> 
   <body> 
      <input type="text" id="inputField">  
   </body>
</html>

Related Tutorials