Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    May 2007
    Location
    NW USA
    Posts
    63
    Thanks
    0
    Thanked 2 Times in 1 Post

    Question about 'onblur' event

    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 with an example; the onblur event is included; it works in IE and Firefox but not Safari or Opera.

    lorie

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,992
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    There is an error:

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

    Also
    Line 31 Char 1
    'dv' is undefined.

    These may be the problem. Somtimes IE is more forgiving.
    Last edited by Philip M; 05-01-2008 at 07:21 PM.

  • #3
    New Coder
    Join Date
    May 2007
    Location
    NW USA
    Posts
    63
    Thanks
    0
    Thanked 2 Times in 1 Post
    Philip,

    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

    Code:
    onclick="dv.showDV(king); return false" onblur="dv.hideDV(king)"
    is there some other way to tell this image to go away?

    lorie

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,992
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    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.

  • #5
    Senior Coder BarrMan's Avatar
    Join Date
    Feb 2005
    Location
    Israel.
    Posts
    1,644
    Thanks
    69
    Thanked 83 Times in 82 Posts
    Try adding tabindex="0"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •