Display attributes for hyper link : getAttribute « Node Operation « JavaScript DHTML






Display attributes for hyper link

 

<html>
<head>
    <title>Show Attribs</title>
    <script type = "text/javascript">
    function showattribs(e) {
        var e = document.getElementById("website");
        var elemList = "";
        for (var element in e) {
            var attrib = e.getAttribute(element);       
            elemList = elemList + element + ": " + attrib + "\n";
        }
        document.write(elemList);
    }
    </script>
</head>
<body>
<a onclick="showattribs()" href="http://www.google.com" id="website">link</a>
</body>
</html>

   
  








Related examples in the same category

1.'getAttribute()' Example