este sencillo javascript, como su nombre lo indica nos muestra un mensaje aleatoriamente ( random ) cada vez que cargamos la página.
<html>
<title>random javascript frases 1.0</title>
<head>
<script type="text/javascript">
<!-- comienzo del javascript
// *****************************************
// gabriel rodríguez, enero del 2001. bs as
// -----------------------------------------
//
// http://www.gamarod.com.ar
// e-mail: gamarod@gamarod.com.ar
// *****************************************
//
// -----------------------------------------
// mis frases, by gabriel rodríguez '2000
// -----------------------------------------
// version: 1.0
//
// este script puede usarse y distribuirse libremente siempre
// y cuando figure el mensaje de arriba.
<!-- este script muestra frases aleatoriamente -->
var frases = new armarvector ("bienvenido a gamarod javascript", "¿sabías que..? este es un mensaje aleatorio",
"frases aleatorias 1.0 por gabriel rodríguez", "boca juniors es lo más grande de argentina",
"rafael calzada mi ciudad natal ...", "maradona es el mejor jugador del mundo...");
function aleatorio() {
hoy= new date();
maximo=6; //cantidad de frases
segundos=hoy.getseconds();
if (segundos==0) {segundos=1}
while (segundos>maximo) {segundos=segundos-maximo}
document.write ('<table border=1 bgcolor=yellow cellpadding=1 cellspacing=1><tr><td bgcolor=cyan align=center>');
document.write ('<font size=+1 color=blue>');
document.write (frases[segundos]);
document.write ('</font>');
document.write ('</table>');
}
function armarvector (v1, v2,v3,v4,v5,v6) {
this[1]=v1;
this[2]=v2;
this[3]=v3;
this[4]=v4;
this[5]=v5;
this[6]=v6;
}
</script>
</head>
<body bgcolor="#ffffff" text="#000000" link="#000080" vlink="#800080" alink="#ff0000">
<br>
<center><h1>este es la frase del día</h1>
<script>aleatorio()</script>
<br><a href="javascript:history.go(0)">[ver otra frase aleatoria]</a>
<br><br><hr size=1 color="#808080">
<font size=1 color="#000000" face="arial">gabriel rodríguez<br>
<a href="http://www.gamarod.com.ar">gamarod javascript</a>
</font>
</center>
</body>
</html>
Download Script
Ver ejemplo javascript