![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
21/12/2002, 11:44
|
![Avatar de KarlanKas](http://static.forosdelweb.com/customavatars/avatar11549_2.gif) | Moderador extraterrestre | | Fecha de Ingreso: diciembre-2001 Ubicación: Madrid
Mensajes: 6.987
Antigüedad: 23 años, 1 mes Puntos: 61 | |
Queres que cambie el color de fondo de una tabla cada vez que se abra, no?
Bueno, es sencillo. Prueba con este ejemplo <html>
<head>
<script>
function aleatorio(){
var r=Math.random()*255;
var g=Math.random()*255;
var b=Math.random()*255;
var colorTabla="RGB("+r+","+b+","+g+")";
var r2=255-r;
var g2=255-g
var b2=255-b;
var colorLetra="RGB("+r2+","+b2+","+g2+")";
tabla.style.background=colorTabla;
tabla.style.color=colorLetra;
}
</script>
</head>
<body onload="aleatorio()">
<table id="tabla">
<tr>
<td><b>
HOLA</b>
</td>
</tr>
</table>
</body>
Dime cómo te va!
__________________ Cómo escribir
No hay pregunta tonta, sino tonto que quiere seguir en la ignorancia. |