This is problematic. When the input field gets focus the focus event is fired, you handle that event by putting up an alert box which takes focus away (a "blur" event) from the input field. When the alert is dismissed the input field gets focus again, firing the focus even another time, and leading to an endless loop of gain/lose/gain focus. You are getting the focus even more than once because you are changing the focus.
You do not want to do something in a focus handler that changes the focus like this, unless it's something along the lines of "when this control gets focus, send focus to that other control instead".
If you do something that doesn't cause a focus change (which an alert does), such as adding text to a div
when you get focus, you'll see that the event will only occur once.
If you describe what you're actually trying to accomplish you may get better advice. I assume the alert is just a test.