1.获取元素后访问标签名
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>element</title> 5 </head> 6 <body> 7 <div id="div1"></div> 8 <script type="text/javascript"> 9 var oDiv = document.getElementById(‘div1‘); 10 alert(oDiv.tagName) //div 11 alert(oDiv.nodeName) //div 12 </script> 13 </body> 14 </html>
原文:http://www.cnblogs.com/zasqw2222/p/3894064.html