View Full Version : MouseOver Tabella in JavaScript
Ciao a tutti, allora dovrei cambiare il background di una cella (che è in una tabella) con il pasaggio del mouse.
:confused:
Ciau
....
<table width="600" height="400" border="1" class="tabella">
<tr>
<td id="1" height="50" width="100" onMouseOver="over();">???</td>
...
Probabilmente ti basta fare solo questo
<table width="600" height="400" border="1" class="tabella">
<tr>
<td id="1" height="50" width="100" onMouseOver="over(this);">???</td>
ma dovrei vedere il codice javscript della funzione
Probabilmente ti basta fare solo questo
<table width="600" height="400" border="1" class="tabella">
<tr>
<td id="1" height="50" width="100" onMouseOver="over(this);">???</td>
ma dovrei vedere il codice javscript della funzione
e quello il probblema :D !
se me lo trovi mi fai un favore :) Thx Ciao
e quello il probblema :D !
se me lo trovi mi fai un favore :) Thx Ciao
:muro: :confused: :rolleyes: :(
Con una ricerca su google ho trovato:
<script type="text/javascript">
<!--
function setPointer(theRow, thePointerColor)
{
if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
return false;
}
if (typeof(document.getElementsByTagName) != 'undefined') {
var theCells = theRow.getElementsByTagName('td');
}
else if (typeof(theRow.cells) != 'undefined') {
var theCells = theRow.cells;
}
else {
return false;
}
var rowCellsCnt = theCells.length;
for (var c = 0; c < rowCellsCnt; c++) {
theCells[c].style.backgroundColor = thePointerColor;
}
return true;
} // end of the 'setPointer()' function
//-->
</script>
uso:
<td style="background-color:#cccccc" onMouseOver="setPointer(this, '#ffffff');" onMouseOut="setPointer(this, '#cccccc');">???</td>
Oppure puoi farlo direttamente:
<td style="background-color:#cccccc" onmouseover="style.backgroundColor='#ffffff;"
onmouseout="style.backgroundColor='#cccccc'">
vBulletin® v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.