<html> <head> <script type="text/javascript"> function getElement(){ var x=document.getElementById("myHeader") alert("I am a " + x.tagName + " element") } </script> </head> <body> <h1 id="myHeader" onclick="getElement()">Click to see what element I am!</h1> </body> </html>