![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
10/09/2002, 15:26
|
![Avatar de Beakdan](http://static.forosdelweb.com/customavatars/avatar14541_1.gif) | | | Fecha de Ingreso: diciembre-2001 Ubicación: Monterrey, Nuevo León
Mensajes: 433
Antigüedad: 23 años, 1 mes Puntos: 7 | |
Re: script que genera numeros al azar
Código:
//Función para obtener el contenido de una Cookie
function obtieneCookie(nombre){
var nombreCookie = nombre + "=";
var dc = document.cookie;
if (dc.length > 0){
inicio = dc.indexOf(nombreCookie);
if (inicio != -1){
inicio += nombreCookie.length;
fin = dc.indexOf(";", inicio);
if (fin == -1) fin = dc.length;
return unescape(dc.substring(inicio, fin));
}
}
return null;
}
//Para escribir la cookie con los datos que arriba generamos.
defineCookie('numeros', generaNum(), fecha());
//para obtener los datos
var datosCookie = obtieneCookie('numeros');
numb = datosCookie.split(",")
document.write('<center><font color=000080 size=+3>' + numb[0] + '&nbsp;' +
'<font color=993300 size=+3>' + numb[1] + '&nbsp;' +
'<font color=black size=+3>' + numb[2] + '&nbsp;' +
'<font color=green size=+3>' + numb[3] + '&nbsp;' +
'<font color=red size=+3>' + '</font></center>')
//-->
</script>
Espero que te sea útil.
Saludos |