<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml"lang="es" xml:lang="es">
<head>
<meta name="http-equiv" content="Content-type: text/html; charset=UTF-8"/>
<STYLE TYPE="text/css">
#contenedor div.seleccionado {font-weight:bold; background:#F0F0F0; color:#black;}
#contenedor div.deseleccionado {background:#FFFFFF; color:#000000;}
#contenedor div{font:11px verdana; color:#000000; cursor:pointer;
var obj = document.getElementById("contenedor");
if (ajax.readyState==1 || ajax.readyState==2 || ajax.readyState==3) {
obj.innerHTML = "<p align='center'><img src='../images/cargando.gif' border='0px' widht='15px' height='15px'/></p>";
obj.style.display= "block";
}
else if (ajax.readyState==4) {
if (ajax.status==200) {
obj.innerHTML = unescape(ajax.responseText);
}else {
obj.innerHTML = "<p>Se ha producido un error</p>";
}
if (obj.style.display == "none") obj.style.display= "block";
}
},
Seleccionar: function () {
var ref = document.getElementById(this.id).getElementsByTagName('DIV');
//alert(ref);
for (var i = 0; i < ref.length; i++) {
SelUsuario.Evento(ref[i], 'click', function() {
SelUsuario.Pegar(this.id);
//alert(this.id);
})
SelUsuario.Evento(ref[i], 'mouseover', function() {
SelUsuario.Marcar(this.id);
})
//SelUsuario.Evento(ref[i], 'mouseout', function() {
//SelUsuario.DesMarcar(this.id);
//})
}
}
Pegar: function (valor) {
//alert("el val " +valor);
var obj = document.getElementById("contenedor")
document.getElementById("txt").value = valor;
if (obj.style.display == "block"); obj.style.display= "none";
},
Pegar2: function (ev) {
var obj = document.getElementById("contenedor")
var ref = obj.getElementsByTagName('DIV');
var keyCode = document.layers ? ev.which : document.all ? event.keyCode : document.getElementById ? ev.keyCode : 0;
// enter 13 tab 9
if ((keyCode == 13) || (keyCode == 9)) {
//alert("enter")
for (var i = 0; i <= ref.length-1; i++) {
if (ref[i].className == "seleccionado") {
document.getElementById("txt").value = ref[i].id;
//window.focus();
if (obj.style.display == "block"); obj.style.display= "none";
break;
//alert(ref[i].id);
}
}
if (keyCode == 13) {
try{ // DOM;
ev.preventDefault();
}catch(e){ // iexplore;
ev.returnValue = false;
}
}
}
},
BajaOpt: function() {
var ref = document.getElementById("contenedor").getElementsByTagName('DIV');
for (var i = 0; i <= ref.length-1; i++) {
if (ref[i].className == "seleccionado") {
ref[i].className = "deseleccionado";
if (i < ref.length-1){
i++;
}else{
i = 0;
}
//alert("Largo: " +(ref.length-1)+ " Valor: " +i);
ref[i].className = "seleccionado"
}
}
},
SubeOpt: function() {
var ref = document.getElementById("contenedor").getElementsByTagName('DIV');
for (var i = 0; i <= ref.length-1; i++) {
if (ref[i].className == "seleccionado") {
ref[i].className = "deseleccionado";
if (i < ref.length && i > 0){
i--;
}else{
i = ref.length-1;
}
//alert("Largo: " +(ref.length-1)+ " Valor: " +i);
ref[i].className = "seleccionado"
}
}
},
Marcar: function (id) {
var selecionado = document.getElementById(id);
var ref = document.getElementById("contenedor").getElementsByTagName('DIV');
for (var i = 0; i <= ref.length-1; i++) {
if (ref[i].id != id) {
ref[i].className = "deseleccionado";
selecionado.className = "seleccionado";
}
}
},
Cerrar: function () {
var obj = document.getElementById("contenedor")
if (obj.style.display == "block"); obj.style.display= "none";
}
}
SelUsuario.Evento(window, 'load', SelUsuario.init);
</script>
</head>
<body>
<form method="post" action="">
Nombre Usuario: <input name="txt" type="text" id="txt" tabindex="1" value="" size="40" autocomplete="off" />
<div class="vink" style="margin:5px 0px 0px 10px">
<div id="contenedor" class="capa" style="display:none;"></div></div>
Filtrar: <select id="stock" name="stock">
<option selected>Solo con Stock</option>
<option>Sin Stock</option>
</select>
<div class="vink" style="margin:5px 0px 0px 10px">
<div id="stock" class="capa" style="display:none;"></div></div>
<input type="submit" value="Enviar">
</form>
</body>
</html>