key down and alert function