tags:

views:

30

answers:

1

I m trying to get what user type in text box with javascript so i used this

HTML:

JAVASCRIPT: function textTrack(e) { alert(e.keyCode); }

this works fine in firefox but not in IE.

+1  A: 

In MSIE use the global event-object:

alert(window.event.keyCode);
Dr.Molle
I used it but still getting error. Is following html code is right <input id="userData" type="text" value="" onKeyUp="textTrack(event);"></input> because when I start typing (i.e. when event triggers) IE shows javascript error.
To elaborate: your function can be structured to use the appropriate event depending on the browser. function textTrack(e) {if (!e) e=window.event; ...
Zach
If you get more errors, it will be useful to show us textTrack() .
Dr.Molle
thanks for solution.