Forum Moderators: open

Message Too Old, No Replies

capturing the enter key

         

supermanjnk

2:14 pm on Aug 2, 2005 (gmt 0)

10+ Year Member



I have a script to stop people from using enter while entering form information these are the two functions that i'm using

currently enter works in textareas and submit buttons, I want it to also work on links, what would I need to add to make links excluded?

function NetscapeEventHandler_KeyDown(e) {
if (e.which == 13 && e.target.type!= 'textarea' && e.target.type!= 'submit') { return false; }
return true;
}

function MicrosoftEventHandler_KeyDown() {
if (event.keyCode == 13 && event.srcElement.type!= 'textarea' && event.srcElement.type!= 'submit')
return false;
return true;
}

Dijkgraaf

11:01 pm on Aug 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try event.srcElement.tagName!='A'

supermanjnk

12:07 pm on Aug 3, 2005 (gmt 0)

10+ Year Member



Worked perfectly thanks.