prova così...

codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title>test</title>
  <script>
    function cambia(){
        var elements=document.getElementsByTagName('*');
        alert(elements.length);
        for(var n=0;n < elements.length;n++){
            if(elements[n].className == 'tizio'){
                elements[n].style['color']="#ff0000";
                }
            }
        }  
  </script>
  
  </head>
  <body>
    <h2 class="ciccio">ciao mondo</h2>
    <h2 class="tizio">cioa mamma</h2>
    <h2 class="caio">ciao universo</h2>
    <script>cambia()</script>
  </body>
</html>