Copie el código de código de la siguiente manera:
<html>
<guión>
// Establece el color de la fila actual al hacer clic en la fila actualmente seleccionada y restaura los colores y eventos del mouse de filas distintas a la fila actual.
función seleccionarFila(objetivo)
{
var sTable = document.getElementById("ServiceListTable")
for(var i=1;i<sTable.rows.length;i++) //Recorre todas las filas excepto la primera
{
if (sTable.rows[i]!= target) //Determina si la fila está seleccionada actualmente
{
sTable.rows[i].bgColor = "#ffffff" //Establece el color de fondo
sTable.rows[i].onmouseover = resumeRowOver //Agregar evento onmouseover;
sTable.rows[i].onmouseout = resumeRowOut;//Agregar evento onmouseout
}
demás
{
sTable.rows[i].bgColor = "#d3d3d3";
sTable.rows[i].onmouseover = ""; //Eliminar eventos del mouse
sTable.rows[i].onmouseout = ""; //Eliminar eventos del mouse
}
}
}
//Color de fondo de tr cuando se mueve
función filaSobre(objetivo)
{
target.bgColor='#e4e4e4';
}
//El color de fondo de tr al mudarse
función filaOut(objetivo)
{
target.bgColor='#ffffff';
}
//Restaurar el evento onmouseover de tr que admite la función de llamada
función resumeRowOver()
{
filaSobre(esto);
}
//Restaurar el evento onmouseout de tr que admite la función de llamada
función reanudarFilaOut()
{
filaOut(esto);
}
</script>
<cuerpo>
<div onmouseover="javascript:this.style.backgroundColor='red';" onmouseout="javascript:this.style.backgroundColor='blue'">Para las dos últimas funciones resumeRowOver y resumeRowOut, consulta lo que escribí antes ¿Agregar una tabla correspondiente al evento al elemento de la página a través de js HTMLview copia simple al portapapeles?
</div>
<table cellspace="1" cellpadding="0" id="ServiceListTable">
<tr>
<th>El servicio importa</th>
<th>N</th>
<th>Estado</th>
<th>Cerrado</th>
<th>Información</th>
</tr>
<tr onmouseover="rowOver(this)" onmouseout="rowOut(this)" onclick="selectRow(this)">
<td>Contenido relacionado</td>
<td align="centro"></td>
<td align="centro"></td>
<td align="centro"></td>
<td align="centro"></td>
</tr>
<tr onmouseover="rowOver(this)" onmouseout="rowOut(this)" onclick="selectRow(this)">
<td>Contenido relacionado</td>
<td align="centro"></td>
<td align="centro"></td>
<td align="centro"></td>
<td align="centro"></td>
</tr>
<tr onmouseover="rowOver(this)" onmouseout="rowOut(this)" onclick="selectRow(this)">
<td>Contenido relacionado</td>
<td align="centro"></td>
<td align="centro"></td>
<td align="centro"></td>
<td align="centro"></td>
</tr>
<tr onmouseover="rowOver(this)" onmouseout="rowOut(this)" onclick="selectRow(this)">
<td>Contenido relacionado</td>
<td align="centro"></td>
<td align="centro"></td>
<td align="centro"></td>
<td align="centro"></td>
</tr>
</tabla>
</cuerpo>
</html>