Pass result of Javascript function to ajax

I’m trying to create a warning message that alerts a user if their Caps Lock is on when they try to login . I have a javascript function detecting the state of the Caps Lock and an Ajax event on the login field. How do I get the results of the javascript function to be passed to the ajax event and display a message. I tried using javascript alert but SC seems to ignore it. How would I use the display a message macro in conjunction with the call a javascript method macros in the Ajax event?

Seriously, no one knows how to detect caps lock and display a message?