
14/07/2008, 08:47
|
 | Colaborador | | Fecha de Ingreso: febrero-2002 Ubicación: Madrid
Mensajes: 25.052
Antigüedad: 23 años, 1 mes 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, |