perche nel momento che esegui la funzione il dom non è stato caricato interamente... prova ad inserirlo al termine del caricamento della pagina e vedrai che funziona benissimo.

codice:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>Ajax</title>

        <script type="text/javascript" src="javascript/ajax.js"></script>
        <script type="text/javascript" src="javascript/squadre.js"></script>

    </head>

    <body onload="getAllTag()">
        
        <h1>Lista delle squadre</h1>
        

Squadre</p>

    </body>
</html>
codice:
function getAllTag(){
var tag = document.getElementsByTagName("*");

for(var i = 0; i < tag.length; i++){

    alert(tag[i].nodeName);

}
}