PDA

View Full Version : How to hide the Form select option onmouseout IE6?



fsalvador
02-22-2008, 05:36 AM
Hi,
I am trying to figure it out how to to hide in onmouseout the select options of a form. Below is the code I got so far.

It isn't working in IE6.
I am stuck with this so any help will be greatly appreciated.
The z-index is also a problem in IE6.

Reference page:
http://www.oarso.net/kitres/





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<script type="text/javascript">

function hideSelectSearchCon() {
var selectSearchCon = document.getElementById("catGroup");
selectSearchCon.blur();
}

function check_mouse_pos(e) {
if (typeof e == 'undefined') {
e = window.event;
}
var src = typeof window.event == 'undefined' ? e.target : e.srcElement;
var opt = { 'SELECT': 1, 'OPTION': 1 };

if (typeof opt[src.nodeName] == 'undefined') {
hideSelectSearchCon();
remove_event(document, check_mouse_pos);
}
}

function add_event(obj, func) {
if (typeof window.addEventListener != 'undefined') {
obj.addEventListener('mouseover', func, true);
} else {
obj.attachEvent('onmouseover', func);
}
}

function remove_event(obj, func) {
if (typeof window.addEventListener != 'undefined') {
obj.removeEventListener('mouseover', func, true);
} else {
obj.detachEvent('onmouseover', func);
}
}
</script>

</head>

<body id="home">

<!-- #search starts -->


<div id="search-container">
<div id="searchleft"><div id="searchright">
<div id="search">
<form action="/cgi-bin/dbsearch/displayList.cgi" method="post">
Search:
<select name="catGroup" id="catGroup" onclick="add_event(document, check_mouse_pos);" style="z-index: -2">
<option value="" selected="selected">Todos los Articulos</option>
<option value="Maquinas Ejercicio">Maquinas Ejercicio</option>
<option value="Material Deportivo">Material Deportivo</option>
<option value="Accesorios Deportes">Accesorios Deportes</option>
<option value="Mobliario Urbano">Mobliario Urbano</option>
</select>
<input type="submit" border="0" alt="Buscar" id="btn_search"/>
</form>
</div>
</div></div>
</div>
<!-- #search ends -->


</body>
</html>