Philipp Mählmeyer: Probleme mit javascript und onmouseover, onmouseout und onclick

Beitrag lesen

Diesen Quelltext...

----------------------------------------------

<table>
  <tr height="20">
    .....
    <td bgcolor="#CCCCCC" align="center" width="*" onClick="self.location.href='menu.html'"
      onMouseover="this.style.backgroundColor='#CC6600'; mewhite('meto2');"
      onMouseout ="this.style.backgroundColor='#CCCCCC'; meblack('meto2');">
        <div style="cursor:pointer;" id="meto2" class="mblack">Menüpunkt2</div>
    </td>
    <td bgcolor="#CCCCCC" align="center" width="*" onClick="self.location.href='menu.html'"
      onMouseover="this.style.backgroundColor='#006633'; mewhite('meto3');"
      onMouseout ="this.style.backgroundColor='#CCCCCC'; meblack('meto3');">
        <div style="cursor:pointer;" id="meto3" class="mblack">Menüpunkt3</div>
    </td>
    <td bgcolor="#CCCCCC" align="center" width="*" onClick="self.location.href='menu.html'"
      onMouseover="this.style.backgroundColor='#330066'; mewhite('meto4');"
      onMouseout ="this.style.backgroundColor='#CCCCCC'; meblack('meto4');">
        <div style="cursor:pointer;" id="meto4" class="mblack">Menüpunkt4</div>
    </td>
    .....
  </tr>
</table>

----------------------------------------------

(mewhite und meblack sind javascript-funktionen)

... will ich mit hilfe eines javascripts und einer for-schleife erzeugen:

----------------------------------------------

meto = new Array("Menüpunkt1","Menüpunkt2","Menüpunkt3","Menüpunkt4");
meco = new Array("#990033","#CC6600","#006633","#330066");
mebg = "#CCCCCC";

var x = "";

x += '<table>';
x += '<tr height="20">';
  for (var i=2; i<meto.length+1; i++) {
    x += '<td bgcolor="'+mebg+'" align="center" width="*" onClick="self.location.href=''+meto[i-1]+'.html'"
    x += '<div style="cursor:pointer;" id="meto'+i+'" class="mblack">'+meto[i-1]+'</div>';
    x += 'onMouseover="this.style.backgroundColor=''+meco[i-1]+''; mewhite('meto'+i+'');"';
    x += 'onMouseout ="this.style.backgroundColor=''+mebg''; meblack('meto'+i+'');">';
    x += '</td>';
  }
x += '</tr>';
x += '</table>';

document.getElementById('menue').innerHTML = x;

----------------------------------------------

Probleme gibts hier anscheinend mit ' und ".
wie kann ich also z.B. onMouseover="this.style.backgroundColor='#330066'; mewhite('meto4');" im javascript schreiben???

schon mal danke im voraus...