Can't capture <enter> using JS

Background:App intended to be accessed using IE 6.0+.

Db property ‘web access’ set to ue JS when generating pages.

Form event OnKeyPress contains the following code:

if(event.KeyCode==13){

alert(“is enter”)}

else

{

alert(“not enter”)}

It doesn’t matter what I press, I get ‘not enter’.

I found this basic code elsewhere in this forum, over in the 4/5 forum and out at any number of JS sites. I tried it using

…“13”… no joy there either.

I’m pretty new to JS so I’m probably missing something really simple here and would appreciate a shove in the right direction.

TIA

Doug

Subject: Can’t capture using JS

Try This Code:

if(window.event.keyCode == 13) {

// Your Code Here

}

Subject: Can’t capture using JS

Hi Doug,

JS is case sensitive and KeyCode should be written as keyCode (with a lowercase k).

So you code should be:

if(event.keyCode==13){

alert(“is enter”)}

else

{

alert(“not enter”)}

Regards,

René

Subject: Bingo!

Told ya it was something simple.

Thanks for the case sentitive info, that worked perfectly.

Doug