Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I'm trying to capture the tab key in my ASP.NET app, I want it to select the first item in the menu. I've added this line to enable my control to recoginise keypresses:

txtEmployee.Attributes.Add("onkeyup", "ProcessKeyPress()")

 

and then with the javascript function:

function ProcessKeyPress()
{
   var SourceField = event.srcElement;
			
   if(event.keyCode == 9)
   {
       alert('tab pressed!!!');
   }
}

 

This captures lots of other keys... (including enter, shirt, ctrl, etc) just not the tab key... it just tabs off the textbox...

 

what can I do?

Edited by samsmithnz
Posted
as far as i know is javascript clientside language und asp (active SERVER page) a server sided page.. so you still have to use javascript, java applet, flash, which are all clientsided
Posted
as far as i know is javascript clientside language und asp (active SERVER page) a server sided page.. so you still have to use javascript, java applet, flash, which are all clientsided

 

which is what I'm trying to do. Capture the Tab key using javascript, as I said up above.

Posted

oh i was irritated by " I'm trying to capture the tab key in my ASP.NET app"

 

<script type="text/javascript">
<!--
window.captureEvents(Event.KEYPRESS);
window.onkeypress = Input;
function Input(event) {
alert("You pressed: " + event.which );
}
//-->
</script>

 

maybe this helps to get the name for tab only

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...