Quantcast
Channel: Administrator.de - Entwicklung
Viewing all articles
Browse latest Browse all 12900

Bei onclick soll sich die Zeilenfarbe geändert bleiben.

$
0
0
Hallo Ich habe folgendes Problem. Wenn ich mit der Maus eine Zeile auswähle dann sollte sich die Hintergrundfarbe von der Zeile ändern. Das tut die auch, aber wenn ich dann wieder weg fahre dann kommt die alte Farbe wieder. Ich habe das mit einem JavaScript gemacht. <script type="text/javascript" <! function setStyle(obj,e) { if(e) { if(obj.id'clicked') { obj.id='unclicked'; resetStyle(obj,true); return; } obj.id='clicked'; } obj.style.backgroundColor = '#1A3A4D'; obj.style.color = '#102B3B'; } function resetStyle(obj,e) { if(obj.id'clicked') { return; } obj.style.backgroundColor = '#102B3B'; obj.style.color = '#102B3B'; } // </script onMouseover=this.style.backgroundColor=\'#CECBCE\' onMouseout=this.style.backgroundColor="" onclick="setStyle(this,true)" Wo könnte ... 6 Kommentare, 276 mal gelesen.

Viewing all articles
Browse latest Browse all 12900