This example demonstrates how to assign an "onfocusin" event to an input element.
Firefox does not support the onfocusin event.
<!DOCTYPE html> <html> <body> Enter your name: <input type="text" id="fname" onfocusin="myFunction()"> <script> function myFunction() {/*from www. j a v a2 s . co m*/ document.getElementById("fname").style.backgroundColor = "red"; } </script> </body> </html>
Bubbles: Cancelable: Event type: Supported HTML tags: | Yes No FocusEvent ALL HTML elements, EXCEPT: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, and <title> |
---|