Mega Code Archive

 
Categories / JavaScript DHTML / Javascript Properties
 

Get all tags from a page

<html> <head> <title>A Simple Page</title> <script language="JavaScript"> function findhead1()  {     var tag, tags;     tags = "The tags in the page are:"     for(i = 0; i < document.all.length; i++)     {         tag = document.all(i).tagName;         tags = tags + "\r\n" + tag;     }     alert(tags); } </script> </head> <body onload="findhead1()"> <h1>Heading One</h1> </body> </html>