File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes 'this' element not working in IE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark " Watch " New topic

'this' element not working in IE

Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
I have the following code in Mozilla:

<script type="application/x-javascript">
function listElementHandlers(aObj)
return null;
for(var list in aObj)
function dummy()

<input type="text" id="searchField" on keyup="listElementHandlers(this)" on blur="dummy()" >
This lists out all the 'on' events against that element(onkeyup and onblus in ths icase).
This does not work in IE- is it because 'this' in IE represents the document object?
How then do we simulate this in IE?
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
<script type="text/javascript">
function test(){

<input type="text" id="foo" onkeyup="test(this)" />
I agree. Here's the link:
subject: 'this' element not working in IE
Similar Threads
Struts2: dependent drop down problem
Calling javascript's standard function in jsp
combo and text box
making the textbox readonly
IE, javascript, moving to anchors, and setting focus