Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/02/2014, 17:55
charlyalize
 
Fecha de Ingreso: marzo-2009
Mensajes: 32
Antigüedad: 15 años, 1 mes
Puntos: 3
Pregunta manejo del teclado con jquey

hola amigos¡¡¡

estoy trabajando con jQuery JavaScript Library v1.4.4
con la función de manejo del teclado.

<script src="/sistema/js/jquery.min.js"></script>
<script language="JavaScript">
$(function(){
$("input[type=text]").keydown(function(e){
if (e.keyCode == 13) {
var tabIndex = parseFloat($(this).attr("tabindex")) + 1;
$("input[tabindex=" + tabIndex + "]").focus();
return false;
}
if (e.keyCode == 27) {
window.close();
return false;
}
})
})

La función anda perfecto con los input type="text" pero tengo que implementar un select con 3 opciones y al seleccionar un valor y darle enter no me funciona como con los input text.

tienen alguna idea de como solucionarlo???

Gracias...

adjunto el formulario completo...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<script src="/sistema/js/jquery.min.js"></script>
<script language="JavaScript">
$(function(){
$("input[type=text]").keydown(function(e){
if (e.keyCode == 13) {
var tabIndex = parseFloat($(this).attr("tabindex")) + 1;
$("input[tabindex=" + tabIndex + "]").focus();
return false;
}
if (e.keyCode == 27) {
window.close();
return false;
}
})
})
</script>
</head>
<div class="Estilo1" align="center"><strong>CHOFERES</strong></div>
<font color="red"> <b> Todos los campos con "*" son OBLIGATORIOS </b> </font>
<div id="Layer2">
<form name="form1" method="post" action="">
<label class="Estilo2">Movil</label>
<input name="" type="text" readonly="true" tabindex="1" size="3">

<label class="Estilo2">Nombre
<input type="text" name="textfield" tabindex="2" size="35" autofocus>
</label>
<font color="red"> <b> * </b> </font>

<label class="Estilo2">Direccion
<input type="text" name="textfield" tabindex="3" size="35">
</label>
<font color="red"> <b> * </b> </font>

<label class="Estilo2">Localidad
<input type="text" name="textfield2" tabindex="4">
</label>
<font color="red"> <b> * </b> </font>

<label Class="Estilo2">Telefono
<input type="text" name="textfield3" tabindex="5" SIZE="12">
</label>
<font color="red"> <b> * </b> </font>



<label class="Estilo2">DNI
<input type="text" name="textfield4" tabindex="6" size="8">
<font color="red"> <b> * </b> </font>
</label>



<label class="Estilo2">Licencia
<input type="text" name="textfield5" tabindex="7" size="1">
<font color="red"> <b> * </b> </font>
</label>

<label Class="Estilo2">Vencimiento
<input type="text" name="textfield6" tabindex="8">
<font color="red"> <b> * </b> </font>
</label>

<label Class="Estilo2">Base
<input type="text" name="textfield7" tabindex="9" Size="3">
<font color="red"> <b> * </b> </font>
</label>

<label Class="Estilo2">Patente
<input type="text" name="textfield8" tabindex="10" size="5">
<font color="red"> <b> * </b> </font>
</label>

<label class="Estilo2">Marca/Modelo
<input type="text" name="textfield9" tabindex="11" size="10">
<font color="red"> <b> * </b> </font>
</label>


<label Class="Estilo2">Color
<input type="text" name="textfield10" tabindex="12" size="3">
</label>
<p>&nbsp;</p>
</form>
</div>

</body>
</html>

Última edición por charlyalize; 13/02/2014 a las 18:00 Razón: Notificacion por correo