Dennis: getElementsByName

Beitrag lesen

Warum geht das nur in Netscape?

<HTML>
<HEAD>
<script type="text/javascript" language="JavaScript">
<!--

function highlight(high) {
    zellen = document.getElementsByName("menuzelle");
    for (a=0; a<zellen.length; a++) {
        document.getElementsByName("menuzelle")[a].style.backgroundColor="#000000";
        document.getElementsByName("menuzelle")[high].style.backgroundColor="#FF0000";
    }
}

//-->
</script>
</HEAD>
<BODY>

<table>
  <tr>
    <td name="menuzelle" onClick="highlight(0)">Klick!</td>
    <td name="menuzelle" onClick="highlight(1)">Klick!</td>
    <td name="menuzelle" onClick="highlight(2)">Klick!</td>
    <td name="menuzelle" onClick="highlight(3)">Klick!</td>
    <td name="menuzelle" onClick="highlight(4)">Klick!</td>
  </tr>
</table>
</BODY>
</HTML>