<!doctype html>
<meta charset=utf-8/>
<TITLE>HTML5 Web page Effects form verification implementation method </title>
<style>
Body {
font-family: "Helvetica", Arial, Helvetica;
}
Label {
Display:block;
Float:left;
Clear:left;
Text-align:right;
width:100px;
margin-right:10px;
}
div {padding:10px;}
fieldset {border:1px solid #ccc; margin-bottom:20px;}
</style>
<script>
var form = document.getelementsbytagname (' form ') [0];
Form.onsubmit = function (event) {
for (var key in event) {
Dump (key + ' = ' + Event[key] + ');
}
var i = This.length, El;
while (i--, el = this[i]) {
if (el.willvalidate) dump ([El.id, El.validity.valid]);
}
return false;
};
Form.oninvalid = function (event) {
Dump ([].slice.call (event, 0));
Alert (' is not valid ');
};
function dump (obj) {
document.getElementById (' Debug '). innerHTML + = ' <pre> ' + json.stringify (obj) + ' </pre> ';
}
</script>
<body>
<form>
<fieldset>
<legend>round one</legend>
<div><label for= "Email" >email:</label> <input novalidate id= "email" name= "email" type= "email" ></div>
<div><label for= "url" >homepage:</label><input id= url type= url name= "url" required /div>
<input type= "Submit" class= "SaveState" value= "Save" formnovalidate></input>
</fieldset>
<fieldset>
<legend>round two</legend>
<div><label for= "Email2" >email:</label> <input id= "email2" name= "email" type= "email"/></ Div>
<div><label for= "Url2" >homepage:</label><input id= "url2" type= "url" name= "url" required </div>
<input type= "Submit" class= "SaveState" value= "Save" formnovalidate></input>
</fieldset>
<input type= "Submit"/>
</form>
<div id= "Debug" ></div>
</body>