I'm trying to find out when the user clicks on the tab key to determine the type of action to take. Here's what I have in my Visual Studio .net code behind page. txtResumeTitle.Attributes.Add("onKeyDown", "JavaScript: (if(event.keyCode == 9)return textRequired(this,'Please enter your first name.'));"); Code (markup): The error JavaScript error I got is this: Any help is grateful.