Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/06/2011, 17:24
conexion
 
Fecha de Ingreso: febrero-2011
Mensajes: 54
Antigüedad: 13 años, 2 meses
Puntos: 13
Respuesta: ¿Cómo hacer para que un campo de texto se active al ingresar al sitio?

Prueba esto, es lo que yo utilizo:

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Foco en input</title>

<script type="text/javascript">
function focalizar(){
	document.getElementById("foco").focus();
}
</script>
</head>

<body onload="focalizar();">

<p>De esta forma el foco queda dentro del input al cargar la página</p>

<form>
    <input id="foco" type="text" name="foco" size="30" /> 
</form>

</body>

</html>