html5 获取input内容

10/24/2015来源:HTML教程人气:878

<!doctype html>

<html>
<head>
<meta charset=utf-8 />
<title>html5 获取input内容</title>
</head>
<body>
<input type="email" />
<input type="tel" />
<input type="range" />
<input type="url" />
<input type="number" />
<input type="tel" />
<input type="date" />
<input type="datetime" />
<ol id="debug"></ol>

<script>var d = document.getelementbyid('debug');
[].foreach.call(document.queryselectorall('input'), function (el) {
d.innerhtml += '<li>' + el.type;
d.innerhtml += el.getattribute('type') + '</li>';
});
</script>
</body>
</html>