![]() |
folgendes problem: ich hab ne tabelle mit x zellen, bei mouseover, mouseout und mousedown soll sich die farbe ändern. normal ist grau, bei over wirds blau, bei out wieder grau und bei click wirds orange, nur soll die orange-eingefärbte zelle auch so lange orange bleiben bis ich ne andere anklicke. source: </font><blockquote>Code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">var theMarkedRow = null; function setPointerClass(theRow, theRowNum, theAction, DefaultClass, PointerClass, ClickClass) { if ((PointerClass == "" && ClickClass == "") || typeof(theRow.className) == "undefined") { return false; } var c = null; var theCells = theRow.getElementsByTagName("td"); var MarkedCells = null; var MarkedCellsCnt = null; var newClass = DefaultClass; var rowCellsCnt = theCells.length; var currentClass = theCells[0].className; if(theMarkedRow != null && theAction == "click") { MarkedCells = theMarkedRow.getElementsByTagName("td"); MarkedCellsCnt = MarkedCells.lenght for(c=0; c < MarkedCellsCnt; c++) { MarkedCells[c].className = DefaultClass; } theMarkedRow = null; } if(theMarkedRow == null) { theMarkedRow = theRow; } for (c = 0; c < rowCellsCnt; c++) { if(theAction == "click") { newClass = ClickClass; } else if(theAction == "over") { newClass = PointerClass; } else { newClass = DefaultClass; } theCells[c].className = newClass; } return true; }</pre>[/QUOTE]im html-source: </font><blockquote>Code:</font><hr /><pre style="font-size:x-small; font-family: monospace;"><tr onmouseover="setPointerClass(this, 0, 'over', 'td_off', 'td_over', 'td_on')" onmouseout="setPointerClass(this, 0, 'out', 'td_off', 'td_over', 'td_on')" onmousedown="setPointerClass(this, 0, 'click', 'td_off', 'td_over', 'td_on')"></pre>[/QUOTE]in "theMarkedRow" wird auch ein objekt abgespeichert, trotzdem funzt es nicht *gnarf* |
geht das nicht auch einfacher? so á la.. </font><blockquote>Code:</font><hr /><pre style="font-size:x-small; font-family: monospace;"><td onmouseover="this.style.backgroundcolor='#c0c0c0';"></pre>[/QUOTE]..und desgleichen analog mit onmouseout und onclick? also ohne so'n riesenscript wie bei dir meine ich.. ich hatte das vor langem mal zumindest sehr ähnlich gemacht.. hab's nimmer im kopf und bin mir auch nich sicher, ob die syntax so stimmt, aber ich denke, du verstehst den gedankengang, den ich habe. |
ne, ich muss ja die komplette tr einfärben, unabhändig davon wieviel td's sich darin befinden. es geht ja alles, nur merkt der sich nicht global welche zeile gerade eingefärbt ist. |
aahh verstehe.. da muß ich passen.. es sei denn, meine variante funkt auch mit <tr> statt <td>? keine ahnung, sorry ;) |
kannste nicht das tr-elementbyID holen, die jeweils aktive in ne variable packen, und dich freuen? wir machen das jedenfalls so oder so ähnlich, wenn du das noch brauchst, dann guck ich mir das montag mal an.... krieg ich jetzt den preis für die gösste zeitverzögerung bei einer antwort? |
vroni-schbadschi, den blumentopf hab ichheute morgen zur post gebracht. den source könntest du übrigends jetzt durchmailen, hab den udp-treiber fertig und kann jetzt an dem schrott weiter machen. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:36 Uhr. |
Copyright ©2000-2025, Trojaner-Board