1. 程式人生 > >獲取 var items= document.getElementsByTagName("p"); 返回陣列

獲取 var items= document.getElementsByTagName("p"); 返回陣列

node2:/var/www/html/js#cat a17.html 
<p>測試1</p>
<p>測試2</p>
<p>測試3</p>
<p>ggg</p>
<script type="text/javascript" src="jquery-2.2.2.min.js"></script>    
<script type="text/javascript" src="a17.js"></script>
node2:/var/www/html/js#

node2:/var/www/html/js#cat a17.js
var items= document.getElementsByTagName("p");
console.log(items);