Hola:
Puedes obtener todas las etiquetas y sus atributos con el DOM.
Puedes ver algunos ejemplos aqui:
http://www.pepemolina.com/DOM/destripador.html y aqui:
http://www.pepemolina.com/DOM/index.html
Si quieres un código para estudiar en pocas líneas:
Código:
<html>
<head>
<title>1, 2, 3, ¡probando!...</title>
<script>
function destripar(que) {
with (document.getElementById("xx"))
value += "TAG = " + que.tagName + "\natributos:\n";
for (datos in que.attributes)
with (document.getElementById("xx"))
value += datos + " = " + que[datos] + "\n";
with (document.getElementById("xx"))
value += "nº de hijos = " + que.childNodes.length + "\nHijos:\n";
for (var i = 0, total = que.childNodes.length; i < total; i ++)
destripar(que.childNodes[i])
}
</script>
</head>
<body>
<div id="x">
<span onclick="destripar(document.getElementById('x'))">*</span>
<textarea id="xx" cols="100" rows="20"></textarea>
</div>
</body>
</html>
Saludos