Tanker
07-23-2002, 06:45 PM
I have a select box that does a onClick="form.submit()", What I was wondering if it was possible to make the options highlight when the user mouses over them? Something like the following.
Unfortunately onMouseOver and onMouseOut don't seem to work on the individual options, and if I put it in the Select tag it highlight all the options.
<html>
<head>
<title>Untitled</title>
<style>
.selected { color: Yellow; background: Teal; }
.unselected { }
</style>
</head>
<body>
<select name="test" size="5">
<option value="1" onMouseOver="this.className='selected'; return true" onMouseOut="this.className='unselected'; return true">This is option 1</option>
<option value="2" onMouseOver="this.className='selected'; return true" onMouseOut="this.className='unselected'; return true">This is option 2</option>
<option value="3" onMouseOver="this.className='selected'; return true" onMouseOut="this.className='unselected'; return true">This is option 3</option>
<option value="4" onMouseOver="this.className='selected'; return true" onMouseOut="this.className='unselected'; return true">This is option 4</option>
<option value="5" onMouseOver="this.className='selected'; return true" onMouseOut="this.className='unselected'; return true">This is option 5</option>
</select>
</div>
</body>
</html>
Thanks in advance.
Unfortunately onMouseOver and onMouseOut don't seem to work on the individual options, and if I put it in the Select tag it highlight all the options.
<html>
<head>
<title>Untitled</title>
<style>
.selected { color: Yellow; background: Teal; }
.unselected { }
</style>
</head>
<body>
<select name="test" size="5">
<option value="1" onMouseOver="this.className='selected'; return true" onMouseOut="this.className='unselected'; return true">This is option 1</option>
<option value="2" onMouseOver="this.className='selected'; return true" onMouseOut="this.className='unselected'; return true">This is option 2</option>
<option value="3" onMouseOver="this.className='selected'; return true" onMouseOut="this.className='unselected'; return true">This is option 3</option>
<option value="4" onMouseOver="this.className='selected'; return true" onMouseOut="this.className='unselected'; return true">This is option 4</option>
<option value="5" onMouseOver="this.className='selected'; return true" onMouseOut="this.className='unselected'; return true">This is option 5</option>
</select>
</div>
</body>
</html>
Thanks in advance.