Q:

Hot to get the attribute from .getElementsByTagName?

Do not undertand why I can not get the attribute value of tag element by using function getElementsByTagName. 
Also I have no problems with using direct acsess to the element by id , like t.getAttribute('href') from <a id="t">.</a> 

 var a = document.body.getElementsByTagName('a').getAttribute('href');
    console.log(a);
 <a href="###">http://internal.com/</a>

A:

getElementsByTagName will return a array so put the index and get the element you want

 var a = document.body.getElementsByTagName('a')[0].getAttribute('href');
    console.log(a);
<!DOCTYPE HTML>
<html>

<head>
</head>

<body>
    <a href="###">http://internal.com/</a>
</body>

</html>

