The javascript onfocus event handler is used to trigger a script or action when an element gains focus either by a mouse clicking on it, by a script or by a tabbing order. The onfocus event calls the action from the following elements: <a> <area> <button> <input> <label> <select> <textarea> Example: <input type="text" onfocus="alert('Jeepers! I\'ve been touched');"> The above example will output Jeepers! I 've been touched when you click in the text box. The onfocus event can also call a function as follows: <head> <script type="text/javascript"> function touchme() { alert('Jeepers! I\'ve been touched'); } </script> </head> <body> <input type="text" onfocus="touchme();"> DEMO: Click in the text box below to see the effect. See also: