SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast minus's Avatar
    Join Date
    Jan 2002
    Location
    Pittsburgh, PA, USA
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow TEXT INPUT that doesn't get the FOCUS when CLICKED ON

    Hello,

    I try to find a way to have an text input not getting the focus when clicked, but only when doublecliked.

    I tried triggering a function on click that would put the focus on something else, but the value of the text input would still get the focus for half of a second, which isn't satisfactory.

    Fresh ideas?

  2. #2
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <input type="text" onClick="blur()" ondblclick="focus()">

  3. #3
    SitePoint Enthusiast minus's Avatar
    Join Date
    Jan 2002
    Location
    Pittsburgh, PA, USA
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This actually doesn't work with my stuff. Indeed, the onfocus method the input prevents your idea from working (I guess it is because of that).

    My code:

    Code:
    <input type="text" ID="os" value="date" ondblclick="switchEditable(this);this.select()" onkeyup="checky(this)" onClick="????" onfocus="switchEditable(this);this.select()" />
    Thanks anyways...

  4. #4
    SitePoint Enthusiast minus's Avatar
    Join Date
    Jan 2002
    Location
    Pittsburgh, PA, USA
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I m actually looking for would be a way to define a "no-action-at-all" event. Do I make it clear?

    (sorry for the ugly line on the post above )

  5. #5
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    erm you've lost me completely

    no-action-at-all? that would mean you dont have a event handle at then lol.?

  6. #6
    SitePoint Enthusiast minus's Avatar
    Join Date
    Jan 2002
    Location
    Pittsburgh, PA, USA
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried my line of code in your browser?

    I want the same result as what you get with your line but still have the onfocus event handler working.

    Basically, say I have a few fields like this one on a form. All fields are readonly. A field becomes editable if either you doubleclick on it or you get the focus on it by accessing it with the tab key (in case your were editing one field in the form, then you press the key tab -> the next field becomes editable.).

    The field *shouldn't* get the focus if only cliked, only when doubleclicked or accessed thanks to a tab move.

    So I want the "click" event not do anything (no focus, no nothing).

    Does that make more sense to you?


Bookmarks

Posting Permissions

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