31/03/2009, 20:07
|
| | Fecha de Ingreso: marzo-2009
Mensajes: 9
Antigüedad: 15 años, 10 meses Puntos: 0 | |
Respuesta: Eventos onmouseover y onmouseout en varios divs hola david, he probado como recomendaste y este es el codigo y me sale el sgte error:
Mensaje: 'document.getElementById(...)' es nulo o no es un objeto
Línea: 40
Carácter: 2
Código: 0
function resaltar(elEvento)
{
var evento = elEvento || window.event;
switch(evento.type)
{
case 'mouseover':
this.style.backgroundColor = 'black';
break;
case 'mouseout':
this.style.backgroundColor = 'blue';
break;
}
}
window.onload = function()
{
for( var i=0;i<31;i++)
{
document.getElementById("id" + i).onmouseover = resaltar;
document.getElementById("id" + i).onmouseout = resaltar;
}
}
<div id="id1">
<div id="id2">
<div id="id3">
....... |