Since the document knows which object has Focus already, you just need to add an onFocus handler to form elements, images, and/or links. Now when something on the page gets the focus it will call a javascript function and can even send information to that function as in the simple example below:
<body>
<form name="form1">
<input type="text" name="text1" onFocus="whichOne('The Focus is on form1.text1')"><br>
<input type="text" name="text2" onFocus="whichOne('The Focus is on form1.text2')"><br>
<input type="text" name="text3" onFocus="whichOne('The Focus is on form1.text3')"><br>
<input type="text" name="text4" onFocus="whichOne('The Focus is on form1.text4')">
</form>
</body>
</html>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.