View Full Version : Question about 'onblur' event

05-01-2008, 08:13 PM
I have used several scripts which cause an image or tooltip to appear by means of the 'onclick' event; to get rid of the image or tip, the 'onblur' event was used; this does not seem to work anymore with Safari or Opera. So I am wondering what is the current practice for the opposite of 'onclick'? (if that makes any sense...)

Here is a quick page (http://tibug.com/learn/blurry.htm)with an example; the onblur event is included; it works in IE and Firefox but not Safari or Opera.


Philip M
05-01-2008, 08:17 PM
There is an error:

Line 401 Char 50
Unterminated string constant. (i.e missing ")

Line 31 Char 1
'dv' is undefined.

These may be the problem. Somtimes IE is more forgiving.

05-01-2008, 08:32 PM

Thanks for the quick reply; and I will try to find those errors in the code. But my question is actually more generic: what do I need to do to remove/hide any object that I have called with 'onclick'. In the past, you could self-close a pop-up window, remove a tooltip or whatever with the strategically placed 'onblur' but this does not seem to be current practice anymore.

So on the page, where I have

onclick="dv.showDV(king); return false" onblur="dv.hideDV(king)"

is there some other way to tell this image to go away?


Philip M
05-01-2008, 10:34 PM
The onblur event occurs when an object loses focus.

onblur is supported by the following JavaScript objects:-
button, checkbox, fileUpload, layer, frame, password, radio, reset, submit, text, textarea, window
but not an image or a tooltip.

As far as I know Safari and Opera ought to support the same onblur events as IE and Firefox. As I say, some browsers are more forgiving than others.

05-02-2008, 02:45 PM
Try adding tabindex="0"