HTML and CSS Reference
In-Depth Information
ADDING A FORM
Forms are really in two parts (even more in some cases). h e i rst part is the
<form>
tag that
sets up a container for dif erent kinds of input. h e typical form can be envisioned as the
following:
Begin Form
Input 1
Input 2
Input 3
Input 4
End Form
So in discussing forms, we're really talking about the form and its attributes and input
elements and their attributes. With HTML5 forms, you'll i nd plenty of new attributes and
elements.
Just so that you don't get bored, the following (
degree2radians.html
in this chapter's
folder at
www.wiley.com/go/smashinghtml5
) is an example of a simple calculator for
converting degrees into radians (see Chapter 13 for a practical use for the converter). Just
enter the degrees you want converted, and you'll be presented with the equivalent radians.
284
<!
DOCTYPE HTML
>
<
html
>
<
head
>
<
script
type
=
”text/javascript”
>
FormMaster=new Object();
FormMaster.resolveForm=function()
{
const RADCON=Math.PI/180;
degreesNow=document.converter.degrees.value;
radiansNow=degreesNow * RADCON;
document.converter.radians.value=radiansNow;
}
</
script
>
<
style
type
=
”text/css”
>
/*048ABF,049DBF,F2F2F2,595959,0D0D0D */
h3 {
font-family:”Arial Black”, Gadget, sans-serif;
color:#595959;
}
body {
font-family:Verdana, Geneva, sans-serif;
color:#049DBF;
background-color:#0D0D0D;
}
</
style
>
<
meta
http-equiv
=
”Content-Type”
content
=
”text/html; charset=UTF-8”
>