How Capture KeyCode in Mozilla

Hi All, I am writing javascript for capturing the keycode it working well in IE but not Working in Mozilla.

Code is:

in JSHEADER

==================

function keyPress()

{

var pKey = window.event.keyCode;

if(pKey==13)

{

		alert("Enter Key Press");

 }

}

=====================

And on Text Field (onkeypress event) I am calling the function.

Its Working in IE But not in Mizilla.

Any Body have idea.

Pawan Kumar

Sr. Lotus Notes Developer

V2solutions

Subject: How Capture KeyCode in Mozilla

Hi All Experts, I have solved the problem,

==========================================

function capturekey(e)

{

var key=(typeof event!=‘undefined’)?window.event.keyCode:e.keyCode;

if(key==13)

 {

   alert ("Enter Key ");

 } 

}

============================

Thanks for ur Support

PAwan Kumar

Lotus Notes Developer

V2solutions

Subject: How Capture KeyCode in Mozilla

Put following things into a editor (maybe Notepad) then save as something.htm and open it in a webbrowser (Mozilla, IE …) it shows you how to capture KeyEvents for the most webbrowser :slight_smile:

<title>Wie überwache ich Tastatur-Events?</title>
#description { border-color: #9CCEFF; border-bottom-width: 1px; border : groove #9CCEFF; font-size : 0.9em; letter-spacing : 1px; padding : 5px; background-color: #FFCE63; layer-background-color: #FFCE63; } td, th{ margin: 0px; padding: 1px; font-size : 0.9em; letter-spacing : 1px; background-color: #FFCE9C; } input { font-family: "Courier new", courier, sans-serif; }

Testen Sie Ihre Tastatur. Die Ergebnisse werden

in den entsprechenden Textfeldern ausgegeben.

<td><input type="text" name="keyCodeP"  size=12 readonly></td>

<td><input type="text" name="keyCodeD"  size=12 readonly></td>

<td><input type="text" name="keyCodeU"  size=12 readonly></td></tr>
<td><input type="text" name="whichP" size=12 readonly></td>

<td><input type="text" name="whichD" size=12 readonly></td>

<td><input type="text" name="whichU" size=12 readonly></td></tr>
<td><input type="text" name="charCodeP" size=12 readonly></td>

<td><input type="text" name="charCodeD" size=12 readonly></td>

<td><input type="text" name="charCodeU" size=12 readonly></td></tr>
<td><input type="text" name="altPressed"   size=12 readonly></td>

<td><input type="text" name="altDown"   size=12 readonly></td>

<td><input type="text" name="altUp"   size=12 readonly></td></tr>
<td><input type="text" name="ctrlPressed"  size=12 readonly></td>

<td><input type="text" name="ctrlDown"  size=12 readonly></td>

<td><input type="text" name="ctrlUp"  size=12 readonly></td></tr>
<td><input type="text" name="shiftPressed" size=12 readonly></td>

<td><input type="text" name="shiftDown" size=12 readonly></td>

<td><input type="text" name="shiftUp" size=12 readonly></td></tr>
  keypress keydown keyup
Zeichen [e.keyCode]
Zeichen [e.which]
Zeichen [e.charCode]
ALT
CTRL
SHIFT