Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Control where 'Enter Button' takes you

Reply
Thread Tools

Control where 'Enter Button' takes you

 
 
=?Utf-8?B?QUNhdW50ZXI=?=
Guest
Posts: n/a
 
      02-09-2005
Hi there..
I write in a textbox to search for something on my asp.net page and when i
click the enter button, i want the Find button to be activated..
instead, one of the other buttons is being pressed. I found this code but
it is not working... any ideas???

<body onkeydown="if(event.keyCode == 13)
{document.getElementById('myBtn').click();}">


--
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
=?Utf-8?B?R29sZA==?=
Guest
Posts: n/a
 
      02-09-2005
Normally, when the controls rendered in the browser one of the control will
receive the default focus. Change this order and make your search button to
get the default focus, that's all..no need write any scripts..

Regards,
thangam

"ACaunter" wrote:

> Hi there..
> I write in a textbox to search for something on my asp.net page and when i
> click the enter button, i want the Find button to be activated..
> instead, one of the other buttons is being pressed. I found this code but
> it is not working... any ideas???
>
> <body onkeydown="if(event.keyCode == 13)
> {document.getElementById('myBtn').click();}">
>
>
> --
> (E-Mail Removed)

 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      02-09-2005
Pressing enter activates first submit button.
Either make the Find button first, or make other button HtmlButtons or look
at http://www.allasp.net/enterkey.aspx for more details/options.

Eliyahu

"ACaunter" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi there..
> I write in a textbox to search for something on my asp.net page and when i
> click the enter button, i want the Find button to be activated..
> instead, one of the other buttons is being pressed. I found this code but
> it is not working... any ideas???
>
> <body onkeydown="if(event.keyCode == 13)
> {document.getElementById('myBtn').click();}">
>
>
> --
> (E-Mail Removed)



 
Reply With Quote
 
William F. Robertson, Jr.
Guest
Posts: n/a
 
      02-09-2005
Try returning false from the event.

if ( event.keyCode == 13 ) { document.all["myBtn"].click(); return false; }

See if that works.

What is it doing currently?

bill

"ACaunter" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi there..
> I write in a textbox to search for something on my asp.net page and when i
> click the enter button, i want the Find button to be activated..
> instead, one of the other buttons is being pressed. I found this code but
> it is not working... any ideas???
>
> <body onkeydown="if(event.keyCode == 13)
> {document.getElementById('myBtn').click();}">
>
>
> --
> (E-Mail Removed)



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
wireless zero config not displaying any signals, if any third partywireless client takes control and gives control back to wzc Naresh Samba Wireless Networking 6 06-09-2009 06:52 PM
Perl takes a lot of memory when you just require a file RJ Perl Misc 5 02-19-2007 07:27 PM
How Do You Tell How Long it Takes for a Piece of Code to Execute? kvnsmnsn@hotmail.com Java 8 07-18-2006 09:18 PM
Compilation failed while compling window user control which takes reference of Activex control ashish_gokhale ASP .Net 0 05-05-2005 01:36 PM
Enter Button Takes You to HomePage =?Utf-8?B?TXJNaWtl?= ASP .Net 3 01-07-2005 04:10 PM



Advertisments