table onkeypress caught in IE. not in FF!!

M

Manish Tomar

Hi,

Following code seems to be working in IE but not in firefox.

<table border="0" cellpadding="0" cellspacing="0"
onkeypress="alert('key');">
<tr>
<td align="center" valign="middle">M</td>
<td align="center" valign="middle">a</td>
<td align="center" valign="middle">n</td>
</tr>
</table>

"key" alert is not displayed in FF. But gets displayed in IE while
pressing any key after selecting the table. As expected it doesn't
work when I press key on other elements of the document. Any reasons
why this is happening??

Another interesting thing I noted was that printable keys like a-z,
0-9, numpad keys were caught whereas other control keys like Alt,
Ctrl, Function keys (ESC was caught) were not caught. Why so? The
following page http://www.w3.org/2002/09/tests/keys2.html registers
key events on input box which captures all keys. Is it like all form
related elements can capture keys? But html spec allows these events
to be registered on table & other elements.

Thanks in advance,
Manish
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top