Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/07/2008, 08:47
Avatar de JavierB
JavierB
Colaborador
 
Fecha de Ingreso: febrero-2002
Ubicación: Madrid
Mensajes: 25.052
Antigüedad: 22 años, 3 meses
Puntos: 772
Respuesta: ¿Como puedo saber qué elemento tiene el foco?

Hola eContento

Prueba este ejemplo:

Código:
<html>
<head>
<script type="text/javascript">
var foco='';
</script>
</head>
<body>
<input type="text" id="txt1" onfocus = "foco=this.id" />
<input type="text" id="txt2" onfocus = "foco=this.id" />
<input type="button" onclick="alert(foco)" />
</body>
</html>
Saludos,