HTML and CSS Reference
In-Depth Information
<
title
>
Convert Degrees to Radians
</
title
>
</
head
>
<
body
>
<article>
<header>
<
h3
>
Degree to Radian Converter
</
h3
>
</header>
<section>
<
form
name
=converter>
Enter degrees:
<
br
>
<
input
type
=number
name
=degrees required >
<
br
>
Radians:
<
br
>
<
input
type
=number
name
=radians>
<
br
>
<
input
type
=submit
name
=submit
value
=
”Convert to Radians”
onClick
=
”FormMaster.
resolveForm()”
>
</
form
>
</section>
</article>
</
body
>
</
html
>
If you're at all familiar with forms in HTML, you know that this form is dif erent — it has a
number input that treats the entries as real numbers instead of text that has to be converted to
numbers by JavaScript. h at wasn't available in older versions of HTML. Figure 14-1 shows
the number “spinners” that appear in Opera when Web pages use the number input.
285
Figure 14-1: Entering numbers for calculations and conversion.
As you'll see in this chapter, much is new, and using JavaScript and (later) PHP, you can do a
great deal with HTML5 forms. So, prepare to i nd a good deal of new features and reasons to
update your browsers to HTML5.