萬盛學電腦網

 萬盛學電腦網 >> 網頁制作 >> Html5 >> html5 獲取input內容

html5 獲取input內容

 <!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>

copyright © 萬盛學電腦網 all rights reserved