newsmainboard.js
Código:
index.html/* a = id de la tabla a animar b = orientacion izquierda o derecha c = inicia en la celda d = termina en la celda e = intervalo de tiempo */ function resaltar(a,b) { var color = ["#999999","#333333"]; tabla = document.getElementById(a); filas = tabla.getElementsByTagName("tr") ; if(filas[0].getElementsByTagName("th").length > 0) { columnas = filas[0].getElementsByTagName("th"); }else if(filas[0].getElementsByTagName("td").length > 0) { columnas = filas[0].getElementsByTagName("td") } var rpt = filas.length; for(x=1; x <= rpt; x = x+1) { nt = x-1; if(b=='izq') { tl = filas[nt].getElementsByTagName("td"); setTimeout(tl[0].style.backgroundColor=color[0],10000); setTimeout(tl[0].style.backgroundColor=color[1],10000); }else if(b=='der') { tl = filas[nt].getElementsByTagName("td"); tl[(tl.length)-1].style.backgroundColor=color[0]; } } setTimeout(tl[0].style.backgroundColor=color[0],10000); }
Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Animacion</title> <script type="text/javascript" language="javascript" src="animar.js"></script> </head> <body onload="resaltar('noticias','izq'); "> <div> <table style="width: 100%;border:thin black solid" id="noticias"> <tr> <td> <img src="t26-06-09-b.jpg" width="60" height="39" alt="" /> a</td> <td> </td> </tr> <tr> <td> <img src="t26-06-09-b.jpg" width="60" height="39" alt="" />b</td> <td> </td> </tr> <tr> <td> <img src="t26-06-09-b.jpg" width="60" height="39" alt="" />c</td> <td> </td> </tr> <tr> <td> <img src="t26-06-09-b.jpg" width="60" height="39" alt="" />d</td> <td> </td> </tr> <tr> <td> <img src="t26-06-09-b.jpg" width="60" height="39" alt="" />e</td> <td> </td> </tr> </table> </div> </body> </html>