Nina: Funktion über nur einen Link

Beitrag lesen

Hi,

hier mein Quelltext - was mache ICH falsch???

<script type="text/javascript">
<!--
var highStatus = false;

function HighlightTag(tagShow,colorShow) {

tagShowEinzeln=tagShow.split(",");

for(var i1 = 0; i1 < tagShowEinzeln.length; i1++) {
 if(highStatus==false){
    for(var i = 0; i < document.getElementsByName(tagShowEinzeln[i1]).length; i++) {
    document.getElementsByName(tagShowEinzeln[i1])[i].style.backgroundColor = colorShow;
    }
 }
 else{
    for(var i = 0; i < document.getElementsByName(tagShowEinzeln[i1]).length; i++) {
    document.getElementsByName(tagShowEinzeln[i1])[i].style.backgroundColor = colorShow;
    }
 }
}

if (highStatus) {
    highStatus = false;
  } else {
    highStatus = true
  }

}

//-->
</script>

<a href="#" onclick="HighlightTag('test','#ff0000'); return false;">test1</a>
<table width="100%">
<tr id="test">
<td>test1</td>
</tr>
<tr id="test">
<td>test2</td>
</tr>
</table>