Ver Mensaje Individual
  #2 (permalink)  
Antiguo 25/03/2012, 18:22
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: necesito codigo.. numero aleatorio cada vez qe actualiza la pagina.

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <title>numeros aleatorios únicos</title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6. <script type="text/javascript">
  7. //<![CDATA[
  8. mezclar = function(n){
  9.    for(var j, x, i = n.length; i; j = parseInt(Math.random() * i), x = n[--i], n[i] = n[j], n[j] = x);
  10.    return n;
  11. };
  12. var secuencia = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
  13. var cadena = mezclar(secuencia).toString();
  14. var numeros = new Array();
  15. numeros=cadena.split(",");
  16. //]]>
  17. </head>
  18. <div style="color: red; font-weight: bold; font-size: 12pt; font-family: arial;">
  19. <script type="text/javascript">
  20. //<![CDATA[
  21. document.write('<p>Podés hacer esto:<\/p>')
  22. document.write(numeros.join(" <br \/> "));
  23. document.write('<p>o podés hacer esto:<\/p>')
  24. for (m=0;m<numeros.length;m++){
  25.        document.write(numeros[m] + " : ");
  26. }
  27. //]]>
  28. </div>
  29. </body>
  30. </html>


Ahi están del 0 al 9, aleatorios y sin repetirse, por lo de construir el formulario no me fijé. Creo que podrías asignar value() y texto a los botones

Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.