Control where 'Enter Button' takes you

Discussion in 'ASP .Net' started by =?Utf-8?B?QUNhdW50ZXI=?=, Feb 9, 2005.

  1. 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();}">


    --
    =?Utf-8?B?QUNhdW50ZXI=?=, Feb 9, 2005
    #1
    1. Advertising

  2. 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();}">
    >
    >
    > --
    >
    =?Utf-8?B?R29sZA==?=, Feb 9, 2005
    #2
    1. Advertising

  3. 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" <> wrote in message
    news:...
    > 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();}">
    >
    >
    > --
    >
    Eliyahu Goldin, Feb 9, 2005
    #3
  4. 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" <> wrote in message
    news:...
    > 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();}">
    >
    >
    > --
    >
    William F. Robertson, Jr., Feb 9, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TXJNaWtl?=

    Enter Button Takes You to HomePage

    =?Utf-8?B?TXJNaWtl?=, Jan 7, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    315
    Curt_C [MVP]
    Jan 7, 2005
  2. TS
    Replies:
    5
    Views:
    14,481
    Jeffrey Tan[MSFT]
    Nov 29, 2005
  3. BrianDH

    Enter Key H*ll, control enter key submit button

    BrianDH, Jan 12, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    389
    Anders Matthiessen
    Jan 12, 2005
  4. Matt
    Replies:
    1
    Views:
    505
    Michael Winter
    Mar 6, 2004
  5. HopfZ
    Replies:
    0
    Views:
    562
    HopfZ
    Aug 28, 2006
Loading...

Share This Page