jpbrassard
Programmer
Hiya,
I've been developing a custom drop-down box to get around the limitations of the <SELECT> tag, using tables and divs and input=text tags. I've got it working up to a point, in that it responds perfectly to mouse events, but to keyboard events it's ... not.
Specifically, what I'm trying to do is this: I have an <INPUT type=text> tag that acts as the primary display for the drop-down box (the actual "drop-down" part uses <DIV> tags and a bunch of CSS and javascript). The <INPUT> tag has been marked "readonly" so that it's not editable. I use the <INPUT> tag's onFocus and onBlur events to fire a couple of javascript functions that change the backgroundColor and color properties accordingly (darkblue/white for onFocus, white/black for onBlur). When the <INPUT> tag gains the focus by a mouse event, it works perfectly. However, when it gains the focus by a keyboard event - that is, when I tab to it - the backgroundColor changes but the text becomes highlighted in white (only during onFocus). And I cannot, for the life of me, figure out why the heck it's doing it, nor have I been able to come up with a fix.
Anyone have any ideas? I'm pretty sure it's got to be something with how the <INPUT type=text> tag works, but I haven't read anything anywhere about this being expected behavior.
Any and all help/ideas/suggestions would be greatly appreciated.
Thanks,
jp
jpbrassard@hotmail.com
I've been developing a custom drop-down box to get around the limitations of the <SELECT> tag, using tables and divs and input=text tags. I've got it working up to a point, in that it responds perfectly to mouse events, but to keyboard events it's ... not.
Specifically, what I'm trying to do is this: I have an <INPUT type=text> tag that acts as the primary display for the drop-down box (the actual "drop-down" part uses <DIV> tags and a bunch of CSS and javascript). The <INPUT> tag has been marked "readonly" so that it's not editable. I use the <INPUT> tag's onFocus and onBlur events to fire a couple of javascript functions that change the backgroundColor and color properties accordingly (darkblue/white for onFocus, white/black for onBlur). When the <INPUT> tag gains the focus by a mouse event, it works perfectly. However, when it gains the focus by a keyboard event - that is, when I tab to it - the backgroundColor changes but the text becomes highlighted in white (only during onFocus). And I cannot, for the life of me, figure out why the heck it's doing it, nor have I been able to come up with a fix.
Anyone have any ideas? I'm pretty sure it's got to be something with how the <INPUT type=text> tag works, but I haven't read anything anywhere about this being expected behavior.
Any and all help/ideas/suggestions would be greatly appreciated.
Thanks,
jp
jpbrassard@hotmail.com