Codeless Posted August 2, 2005 Posted August 2, 2005 I have this script on my login page where there are two textboxes that collect username and password: <SCRIPT LANGUAGE="javascript"> if (document.all) { document.onkeydown = function () { var key_enter= 13; if (key_enter==event.keyCode) { document.getElementById('LinkButton1').click() } } } </SCRIPT> I also have an event that handles the linkbutton1.click event in the code behind. I've got two questions...Why is it beeping when I press enter? And the second is the password dissapears when I tab over to linkbutton1. Anyone know why? Quote Codeless ...it just goes on and on.
rot13 Posted August 2, 2005 Posted August 2, 2005 I don't know C#, and I don't know ASP.Net, but in VB.Net for Windows Forms, this is what you have to do to remove the beep: Public Sub TextBox_Keypress(ByVal sender As Object, ByVal e As System.KeyPressEventArgs) 'or w/e it should be If convert.tochar(keys.enter) = e.keychar then 'do whatever here e.Handled = True 'removes the beep End If End Sub Quote
Codeless Posted August 2, 2005 Author Posted August 2, 2005 Thanks for taking the time to respond. However, ASP doesn't have 'handled' as a system event argument. Thanks though! Quote Codeless ...it just goes on and on.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.