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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Aug 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Determining which <option> has focus

    Please help - I was wondering if anyone knows how to determine in Javascript which option of a select currently has the focus (as opposed to which item is selected).

    The reason for this requirement is :

    I have a select field on my page that has a fixed width (and cannot be changed), and the text for some options is too long so that the text is truncated and the user cannot see it all.

    As the user moves the mouse over the options in the select field, after a small delay, I want to have a small popup window appear that displays the full text of the options.

    The only difficult thing about this is - during the select's onmousemove event, I need to know what option currently has the focus.

    Is this possible? Does anyone have a better solution???

    Thanks
    Daniel

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    This works in Gecko browsers (NS7, Mozilla, Firefox)

    <select>
    <option title="This is item 1">item 1</option>
    <option title="This is item 2">item 2</option>
    </select>

    onmouseover/onmouseout events are also supported.

  • #3
    New to the CF scene
    Join Date
    Aug 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    unfortunately im developing for IE exclusively (intranet)

    thanks for your response glenngv

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    Feel sorry that IE doesn't support that very basic thing in option tags.

    You will need to create a custom widget that looks like a dropdown in order to make it work in IE. I think I've seen something like that here in CF. I think someone posted it, something like editable dropdown script.

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    I saw it!

    ListBox upgrade

    I was correct it was Vladdy who made it.

  • #6
    New to the CF scene
    Join Date
    Aug 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up yay

    thanks for that, it will work a treat i think

    definately is some spiffy code there by Vladdy


  •  

    Posting Permissions

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