|
Using JavaScript to DropDown an HTML Select on MouseOver |
|
|
|
Written by Peyman
|
|
Wednesday, 09 September 2009 |
|
Using JavaScript to DropDown an HTML Select on MouseOver An HTML SELECT can be programmatically dropdown on MouseOver using JavaScript. On MouseOut, we can get the SELECT to its default positions. Here's how to do it
<html xmlns="http://www.w3.org/1999/xhtml"> <head>
<title>Drop on Hover</title>
<script type="text/javascript">
function DropList() {
var n = document.getElementById("sel").options.length;
document.getElementById("sel").size = n;
}
</script> </head> <body>
<div>
<select id="sel" onmouseover="DropList()" onmouseout="this.size=1;">
<option>One</option>
<option>Two</option>
<option>Three</option>
<option>Four</option>
<option>Five</option>
<option>Six</option>
<option>Seven</option>
<option>Eight</option>
</select>
</div>
</body> </html>
|