Professional Documents
Culture Documents
Alex Sánchez
Contenido
Introducción
Formularios
CSS
Javascript
Enlaces interesantes
Formularios
http://www.w3.org/TR/html4/interact/forms.html
CSS
http://www.w3schools.com/css/
Programación web
http://ingenieriasimple.com/introprogra/
Scripts
http://www.hscripts.com/index.php
HTML – CSS – Javascript
Página Web
•• Párrafos ••Tablas
Párrafos
• Encabezados
Tablas
• Capas
Estructura
Estructura •• Listas •• Etc.
Capas
HTML
Encabezado • Etc.
s
• Textos
• Listas
Contenido
Contenido • Imágenes
• Enlaces
• Formularios
• Colores • Fondos
CSS
Apariencia • Tipografías
• Alineación
• Tamaños
• Etc.
• Efectos
Javascript
Comportamiento • Validaciones
• Automatización
HTML+CSS+Javascripts:
Páginas dinámicas (1)
HTML básico --> páginas estáticas correctas, pero limitadas
Si el número de páginas aumenta cuesta mantener un aspecto homogéneo.
No es posible interactuar con el contenido de la página ni con el servidor,
Algunos elementos avanzados solucionan estos problemas
CSS: Gestionar el aspecto de un grupo de páginas de forma homogénea
Formularios:
Permiten introducir información que podrá enviarse a otros usuarios
Permiten instalar controles que pueden usarse para desencadenar acciones
CGIs: Permiten ejecutar programas en el servidor a partir de información proporcionada por el cliente.
Scripts: Permiten ejecutar programas en el navegador mismo. Para ello se necesita
Formularios para introducir la información
Lenguaje de scripting como Javascript, VBAscript
Formularios
¿Para qué sirven?
Elementos para Formularios
Campos de Texto
Casillas de Verificación
Botones de opción
Menús
Botones
Campos ocultos
Campos de carga de archivos
¿Cómo se envía la información?
¿Se pueden validar los Campos?
http://www.w3.org/TR/html4/interact/forms.html
Formularios
Secciones de un documento con
Contenido normal, código html y además
Controles (elementos especiales) y etiquetas.
Suelen servir para suministrar
Información
Indicaciónde acción
que se envia a un servidor
Formularios
Elemento <FORM>
Atributos: method, action
Elemento <INPUT>
Atributo: type (text, checkbox, radio, button, hidden)
Elemento <SELECT>
Elemento <TEXTAREA>
The <form> tag
The <form arguments> ... </form> tag encloses form elements
(and probably other HTML as well)
The arguments to form tell what to do with the user input
action="url" (required)
Specifies where to send the data when the Submit button is clicked
method="get"(default)
Form data is sent as a URL with ?form_data info appended to the end
Can be used only if data is all ASCII and not more than 100 characters
method="post"
Form data is sent in the body of the URL request
Cannot be bookmarked by most browsers
target="target"
Tells where to open the page sent as a result of the request
target= _blank means open in a new window
target= _top means use the same window
9
The <input> tag
Most, but not all, form elements use the input tag, with a
type="..." argument to tell which kind of element it is
type can be text, checkbox, radio, password, hidden, submit, reset,
button, file, or image
Other common input tag arguments include:
name: the name of the element
value: the “value” of the element; used in different ways for different
values of type
readonly: the value cannot be changed
disabled: the user can’t do anything with this element
Other arguments are defined for the input tag but have meaning
only for certain values of type
10
Buttons
A submit button:
<input type="submit" name="Submit" value="Submit">
A reset button:
<input type="reset" name="Submit2" value="Reset">
A plain button:
<input type="button" name="Submit3" value="Push Me">
type: "checkbox"
name: used to reference this form element from JavaScript
value: value to be returned when element is checked
Note that there is no text associated with the checkbox—you
have to supply text in the surrounding HTML
12
Radio buttons
Radio buttons:<br>
<input type="radio" name="radiobutton" value="myValue1">
male<br>
<input type="radio" name="radiobutton" value="myValue2" checked>
female
If two or more radio buttons have the same name, the user can
only select one of them at a time
This is how you make a radio button “group”
If you ask for the value of that name, you will get the value
specified for the selected radio button
As with checkboxes, radio buttons do not contain any text
13
Drop-down menu or list
A menu or list:
<select name="select">
<option value="red">red</option>
<option value="green">green</option>
<option value="BLUE">blue</option>
</select>
Additional arguments:
size: the number of items visible in the list (default is "1")
multiple: if set to "true", any number of items may be
selected (default is "false")
14
Hidden fields
<input type="hidden" name="hiddenField" value="nyah">
<-- right there, don't you see it?
15
Ejemplo de formulario (1)
<HTML>
<HEAD>
<TITLE>Un formulario sencillo</TITLE>
</HEAD>
<BODY>
<H1>Formularios</H1>
</BODY>
</HTML>
Ver ejemplo
Ejemplo de formulario (2)
<HTML>
<HEAD>
<TITLE>Entrada de datos a un formulario</TITLE>
</HEAD>
<BODY>
<H1>Formularios</H1>
<BR><BR>
<INPUT TYPE="submit"><INPUT TYPE="Reset">
</FORM>
</BODY>
</HTML>
Ver ejemplo
Ejercicio 1
Margen
Borde
Relleno
Estilos de listas
Estilos CSS
Una hoja de estilos consiste en un conjunto de reglas.
Cada regla esta formada por:
El Selector (nombre del estilo)
La Declaración (define el estilo)
h2 {
Propiedad text-align: center;
Valor
color: blue;
¿Qué podemos hacer con los estilos?
Redefinir estilos de Etiquetas HTML. font: italic large
Crear Estilos Personalizados para
uso genérico (Clases) "Times New Roman",
Crear Estilos para un elemento
serif;
}
.textoresaltado {
Como incluir estilos CSS
Inline Styles <h2 style="color: blue; background:
Utilizando el atributo “style” se define el estilo green;">
de un elemento HTML en forma individual. Curso HTML UCEMA
</h2>
Embedded Style
<head>
Se define la regla CSS dentro de un <style type="text/css">
documento HTML. Se puede aplicar a h2 {
font-style: italic;
cualquier elemento de ese documento. font-weight: bold;
Hojas de Estilos externas color: blue;
}
Un archivo CSS independiente que se
</style>
encuentra referenciado en cada uno de los </head>
documentos HTML que desean utilizarlo. <body>
<h2>Curso HTML UCEMA</h2>
</body>
<head>
<link rel=stylesheet type="text/css“
href=“estilos.css">
</head>
Ejercicio 2