You are on page 1of 2

<html>

<head>

<title>Ejemplo 18</title>

</head>

<body>

<H1>EL MUNDO SIGUE SIENDO CRUEL</H1>

<H2>REPASANDO FORMULARIOS</H2>

<legend>Alta de usuario</legend>

<form action="control1.html" id="formulario1" name="formRegistro" method="post">

Usuario: <INPUT TYPE="text" ID="entrada1" NAME="nombreUsuario" MAXLENGTH="8" />

(Máximo 8 caracteres)<BR />

Contraseña: <INPUT TYPE="password" ID="entrada2" NAME="clave" /><BR />

Correo electrónico <INPUT TYPE="email" ID="entrada3" NAME="correo" size="40" /><BR />

País: <SELECT id="seleccion1" name="pais">

<option id=opcion0" value="">Elige un pais</option>

<option id="opcion1" value="AND">ANDORRA</option>

<option id="opcion2" value="ESP">ESPAÑA</option>

<option id="opcion3" value="POR">PORTUGAL</option>

</SELECT><BR /><BR />

<INPUT type="reset" id="boton1" name="Limpiar formulario" />

<INPUT type="submit" id="boton2" name="Enviar" />

</form>

<script type="text/javascript">
var formulario1= document.forms[0];

function mostrarPropiedades(campo) {

var datos = "El campo "+campo.name+" y sus propiedades son: \n";

datos +="ID: "+campo.id + "\n";

datos +="Nombre: "+campo.name + "\n";

datos +="Tipo: "+campo.type + "\n";

datos +="Valor: "+campo.value + "\n";

datos +="Deshabilitado: "+campo.disabled + "\n";

datos +="sólo lectura: "+campo.readOnly + "\n";

alert (datos);

//

mostrarPropiedades(formulario1.nombreUsuario);

mostrarPropiedades(formulario1.clave);

mostrarPropiedades(formulario1.correo);

mostrarPropiedades(formulario1.pais);

</script>

</body>

</html>

You might also like