Académique Documents
Professionnel Documents
Culture Documents
What is HTML?
HTML is amarkuplanguage
fordescribingweb documents (web
pages).
HTML stands
forHyperTextMarkupLanguage
A markup language is a set ofmarkup tags
HTML documents are described byHTML
tags
Each HTML tagdescribesdifferent
document content
HTML Tags <tagname>content</tagname>
<th>Firstname</th>
<td>94</td>
</tr>
<th>Lastname</th>
<tr>
<th>Points</th>
<td>John</td>
</tr>
<td>Doe</td>
<tr>
<td>Jill</td>
<td>80</td>
<td>Smith</td>
</tr>
</table>
<td>50</td>
</tr>
</body>
<tr>
HTML Forms
The <form> Element
HTML forms are used to collect user input.
The<form>element defines an HTML form:
HTML forms containform elements.
Form elements are different types of input
elements, checkboxes, radio buttons, submit
buttons, and more.
HTML Form Elements
Tag Description
<form> Defines an HTML form for user input
<input> Defines an input control
<textarea> Defines a multiline input control (text area)
<label> Defines a label for an <input> element
<fieldset> Groups related elements in a form
<legend> Defines a caption for a <fieldset> element
<select> Defines a drop-down list
<optgroup Defines a group of related options in a drop-down list
>
<option> Defines an option in a drop-down list
<button> Defines a clickable button
<datalist> Specifies a list of pre-defined options for input controls
<output> Defines the result of a calculation
HTML Form Elements
Text Input
<form>
First name:<br>
<inputtype="text"name="firstname"><br>
Last name:<br>
<inputtype="text"name="lastname">
</form>
Radio Button Input
<form>
<inputtype="radio"name="gender"value="male"
checked>Male<br>
<inputtype="radio"name="gender"value="femal
e">Female<br>
<inputtype="radio"name="gender"value="other"
>Other
</form>
HTML Form Elements
The Submit Button
<formaction="action_page.php">
First name:<br>
<inputtype="text"name="firstname"value="Mickey"><br>
Last name:<br>
<inputtype="text"name="lastname"value="Mouse"><br><br>
<inputtype="submit"value="Submit">
</form>
The Action Attribute
Theaction attributedefines the action to be
performed when the form is submitted.
The common way to submit a form to a server, is by
using a submit button.
Normally, the form is submitted to a web page on a web
server.
<formaction="action_page.php"method="get">
HTML Form Elements
The Name Attribute
<formaction="action_page.php">
First name:<br>
<inputtype="text"value="Mickey"><br>
Last name:<br>
<inputtype="text"name="lastname"value="Mouse"><br><br
>
<inputtype="submit"value="Submit">
</form>
HTML Form Elements
Grouping Form Data with <fieldset>
<formaction="action_page.php">
<fieldset>
<legend>Personal information:</legend>
First name:<br>
<inputtype="text"name="firstname"value="Mickey"><br>
Last name:<br>
<inputtype="text"name="lastname"value="Mouse"><br><br>
<inputtype="submit"value="Submit">
</fieldset>
</form>
HTML Form Elements
The <select> Element (Drop-Down List)
<selectname="cars">
<optionvalue="volvo">Volvo</option>
<optionvalue="saab">Saab</option>
<optionvalue="fiat">Fiat</option>
<optionvalue="audi">Audi</option>
</select>
HTML Form Elements
The <textarea> Element
<textareaname="message"rows="10"col
s="30">
The cat was playing in the garden.
</textarea>
HTML Form Elements
The <button> Element
<buttontype="button"onclick="alert('Hello
World!')">Click Me!</button>
HTML Form Elements
HTML 5 <datalist>
<form action="action_page.php">
<input list="browsers" name="browser">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
<input type="submit">
</form>
HTML Form Elements
HTML5 <output> Element
<formaction="action_page.asp"
oninput="x.value=parseInt(a.value)
+parseInt(b.value)">
0
<inputtype="range" id="a"name="a"value="50">
100 +
<inputtype="number"id="b"name="b"value="50">
=
<outputname="x"for="a b"></output>
<br><br>
<inputtype="submit">
</form>