Overclock.net banner

JavaScript help (simple)

472 Views 2 Replies 3 Participants Last post by  8ball
Why doesn't this work? No errors. (onfocusout does nada, but onfocus works)

edit: Not even replacing it with onfocusout="alert('test');" does anything in Firefox but it works in IE.

edit2: Okay, now that I know it only happens in Firefox my Google searches are helping.

http://www.w3.org/1999/xhtml</a>" xml:lang="en">


See less See more
1 - 3 of 3 Posts
Hmmm, your code doesn't look bad and I wonder why it doesn't work.
I have a suggestion though; insteading of passing the object's id with this.id you could simplify the code by doing this instead:

function focusEvent(this, base) {
if (base == undefined) this.value = '';
else this.value = base;


I don't think there's an eventhandler called "onfocusout" -- the one you're looking for is onblur, which is called when the input field loses focus.


Onfocusout is only compatible with IE6+ and none of the other mainstream browsers.

Onblur works (at least minimally) across all mainstream browsers.

Check out http://www.quirksmode.org/dom/events/index.html for eventhandler compatibility lists -- or if you use aptana, when you write eventhandlers, it'll show you want browsers it generally works with.
1 - 3 of 3 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.