D
David Hearn
I have a javascript function that is fired on the KeyDown event of a
textbox. I am adding the attribute to the textbox at page load to run this
javascript function. The javascript runs as expected and the text box that
is specified in the javascript gets the focus set to it, but my problem is
that the default button on the form is being pressed also so once the
textbox gets the focus, you barely see it before the page redirects. I want
this javascript to run and to somehow cancel out the button click event.
Anyone know how?
Thanks in advance!
function GetEnter() {
if (event.keyCode == 13) // If key that was pressed is Enter key
document.Form1.txtPartNumber2.focus(); //Set focus to txtPartNumber2
}
textbox. I am adding the attribute to the textbox at page load to run this
javascript function. The javascript runs as expected and the text box that
is specified in the javascript gets the focus set to it, but my problem is
that the default button on the form is being pressed also so once the
textbox gets the focus, you barely see it before the page redirects. I want
this javascript to run and to somehow cancel out the button click event.
Anyone know how?
Thanks in advance!
function GetEnter() {
if (event.keyCode == 13) // If key that was pressed is Enter key
document.Form1.txtPartNumber2.focus(); //Set focus to txtPartNumber2
}