-
Notifications
You must be signed in to change notification settings - Fork 64
/
range.html
101 lines (82 loc) · 3.64 KB
/
range.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="text/css" rel="stylesheet" href="css/form.css" />
<title>HTML5 range input type</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<!-- Needed for Forms Feature Detection -->
<script type="text/javascript" src="../../shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
</script>
<!-- Needed for Validation -->
<script type="text/javascript" src="../../shared/js/html5Forms.js" data-webforms2-support="validation,range" data-webforms2-force-js-validation="true">
</script>
</head>
<body id="myExample">
<div id="exampleBlurb">
<p>
This is an example of a HTML5 form using the <code>range</code> and <code>output</code> input types.
As the user slides the <code>range</code> widget, the number next to it will change. This is
becasue the <code>form</code> tag's <code>oninput</code> is set to <code>"document.getElementById('rangeOutput').innerHTML =
'$' + document.getElementById('rangeEl').value"</code>.
<a href="http://www.useragentman.com/blog/?p=1110">Back to User Agent Man HTML5 Forms article </a>
</p>
</div>
<form oninput="document.getElementById('rangeOutput').innerHTML =
'$' + document.getElementById('rangeEl').value" action="http://www.useragentman.com/testForm.php">
<fieldset>
<legend>Personal Information</legend>
<p>Thank you for giving to the Zoltan Hawryluk Entertainment Fund. Your
contribution will ensure that Webmasters in Need will be able to buy
beer when they would otherwise do without.</p>
<p>Form fields labelled <img src="images/asterix.gif" alt="*"/> are mandatory</p>
<table class="formTable">
<tr>
<th>Full Name :</th>
<td><input type="text" name="fullName" value="" required="required" placeholder="Required information" />
<div class="description"><strong>Required.</strong> If you would like to give anonymously,
tough. We find people are more generous when their Good
Name is on the line.</div>
</td>
</tr>
<tr>
<th>Company Name :</th>
<td><input type="text" name="companyName" value="" />
<div class="description">If you are unemployed, please leave
blank.</div>
</td>
</tr>
<tr>
<th>Donation Amount:</th>
<td>
<output class="withRange" id="rangeOutput">-</output>
<input type="range" class="range" id="rangeEl" name="rangeEl" value=""
min="10" max="150" >
<div class="description">This is a <code>range</code>
element, with a <code>min</code> of <code>10</code>
and a <code>max</code> of <code>150</code>. An
placed <code><output></code> tag has been placed
next to it
to show what the value is.</div>
</td>
</tr>
<tr>
<th>Zip Code</th>
<td><input type="text" name="postalCode" value="" required="required"
pattern="(\d{5}([\-]\d{4})?)" data-errormessage="This must be a valid zip code."
/>
<div class="description">Please enter a valid American zip code.
Valid format is <strong>nnnnn</strong> or <strong>nnnnn-nnnn</strong>
where <strong>n</strong>
is a numeric digit.</div>
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Submit Information"/></td>
</tr>
</table>
</fieldset>
</form>
</body>
</html>