meena
02-04-2005, 07:09 AM
There is slight variation in the way IE and Netscape behaves for Event Handlers.
function doSomething(e)
{
var code;
if (!e) var e = window.event;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
var character = String.fromCharCode(code);
alert('Character was ' + character);
}
orhor
02-04-2005, 11:34 AM
im afraid you didnt understand me. when the cursor is in a textbox and user presses a key 'A' in IE and I use this: event.keyCode=124 - pipe (|) will be displayed. IE will behave like pipe was pressed. Not 'A'.
But when I try to set some value into e.keyCode or e.which I get an error: object has only a getter. Any way out?
(My english isnt very well but I think it means this object is read only, isnt it)