Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<meta name="Content-Style-Type" content="text/css">
<title>Example</title>
<script type="text/javascript">
function check (f) {
var e, i = 0
while (e = f.elements[i++]) {
if (e.type == 'text' && !/\S/.test (e.value)) {
alert ('Field "' + e.previousSibling.data + '" is required.')
e.focus()
return false
}
}
}
</script>
<style type="text/css">
fieldset {padding:1ex; width:12em}
label {display:block; margin:1ex; text-align:right}
input {margin-left:1ex; width:7em}
button {display:block; margin:auto}
</style>
</head>
<body>
<form action="some-script.pl" onsubmit="return check (this)">
<fieldset>
<legend>Example</legend>
<label>Name<input name="name" type="text"></label>
<label>E-mail<input name="e-mail1" type="text"></label>
<label><i lang="la" title="and the rest">Et cetera</i><input name="etc" type="text"></label>
<button type="submit">Send</button>
</fieldset>
</form>
</body>
</html>
“The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
—Tim Berners-Lee, W3C Director and inventor of the World Wide Web
Bookmarks