Can you ignore IE6? (please, please... everyone should ignore ie6 at
this point :-) The highlighting should be done w/CSS. If you want all
input types then a style of input:hover {background-color:yellow;} at
the top of your page. No need to handle mouseover/mouseout at all. IE6
doesn't handle :hover psuedo-element on anything other than <a> tags.
But IE6 sucks. :-)
For adding the click toggle, if you're using prototype, or jQuery, or
some other JS framework (you should be) it's a oneliner
OnClick="$(this).toggleClassName('Selected');"
Take a look at
http://w3.techsoftwareinc.com/highlightfield.htm to see
it work. I used a class on the input boxes to allow me to pick out only
specific boxes.
If you view-source, you'll see:
----
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head>
<title>Highlight</title>
<script src="/include/Prototype.js"></script>
<style type="text/css">
.CanHighlight:hover {background-color: yellow;}
.Selected {background-color: yellow;}
</style>
</head>
<body>
<form>
<input type="text" class="CanHighlight"
OnClick="$(this).toggleClassName('Selected');" />
</form>
</body>
</html>
----
-Walden
As an Amazon Associate we earn from qualifying purchases.