I am designing a webpage with a password (yes, I know it can be hacked)

I want to be able have an alert appear in the textbox "mess" when the Caps Lock key is activated. (not just being held down). I have already tried this and it comes out as staying on until you leave the page or mess changes.

Code:
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
    if (Key.isDown(Key.CAPSLOCK)) {
    mess = "CAPS LOCK IS ON!"
    trace("\tCaps Lock == "+Key.isToggled(Key.CAPSLOCK));
    }
};
Key.addListener(keyListener);
What can I put to make the "CAPS LOCK IS ON" go away when the capslock is off?

Thanks much,
FF94