Ver Mensaje Individual
  #3 (permalink)  
Antiguo 02/04/2015, 14:39
Fattony
 
Fecha de Ingreso: abril-2015
Mensajes: 6
Antigüedad: 9 años, 1 mes
Puntos: 0
Respuesta: Atasco con codigo de sorteo

Perdon por el highlight. Ya esta. Y en cuanto a codigo de aleatoriedad a que te refieres? No lo he terminado, no lo he empezado se podria decir, asi que seguro q faltaran muxas cosas. Lo que no se es como comparar cada una de las posiciones con cada una de las otras posiciones, que te diga cual es mayor y que te las escriba ordenadas. Vamos un cacao, gracias por la respuesta
Un saludo

Código Javascript:
Ver original
  1. var a, a1, b, b2, c, c3, d, d4, e, e5 , f, f6, g, g7, h, h8, i, i9, j, j10, k, k11, l, l12, m, m13, n, n14, o, o15;//aqui son los 30 cuadros de texto, 15 por nombres y 15 por puntuacion
  2. var z;//var para el boton y que dispare la funcion sortear()
  3.  
  4. function inicio()
  5. {
  6. a = document.getElementById("jugador1");
  7. a1 = document.getElementById("puntuacion1");
  8.  
  9. b = document.getElementById("jugador2");
  10. b2 = document.getElementById("puntuacion2");
  11.  
  12. c = document.getElementById("jugador3");
  13. c3 = document.getElementById("puntuacion3");
  14.  
  15. d = document.getElementById("jugador4");
  16. d4 = document.getElementById("puntuacion4");
  17.  
  18. e = document.getElementById("jugador5");
  19. e5 = document.getElementById("puntuacion5");
  20.  
  21. f = document.getElementById("jugador6");
  22. f6 = document.getElementById("puntuacion6");
  23.  
  24. g = document.getElementById("jugador7");
  25. g7 = document.getElementById("puntuacion7");
  26.  
  27. h = document.getElementById("jugador8");
  28. h8 = document.getElementById("puntuacion8");
  29.  
  30. i = document.getElementById("jugador9");
  31. i9 = document.getElementById("puntuacion9");
  32.  
  33. j = document.getElementById("jugador10");
  34. j10 = document.getElementById("puntuacion10");
  35.  
  36. k = document.getElementById("jugador11");
  37. k11 = document.getElementById("puntuacion11");
  38.  
  39. l = document.getElementById("jugador12");
  40. l12 = document.getElementById("puntuacion12");
  41.  
  42. m = document.getElementById("jugador13");
  43. m13 = document.getElementById("puntuacion13");
  44.  
  45. n = document.getElementById("jugador14");
  46. n14 = document.getElementById("puntuacion14");
  47.  
  48. o = document.getElementById("jugador15");
  49. o15 = document.getElementById("puntuacion15");
  50.  
  51. z = document.getElementById("boton");
  52. z.addEventListener("click", sortear);
  53.  
  54. }
  55.  
  56. function sortear()//y en esta ecuacion me pierdo, pero hice array y empece ciclo
  57. {
  58. var puntuaciones = [a1.value , b2.value, c3.value, d4.value, e5.value, f6.value, g7.value, h8.value, i9.value, j10.value, k11.value, l12.value, m13.value, n14.value, o15.value];
  59. var ganador = "";
  60. var resultado = puntuaciones[i];
  61. resultado = parseInt();
  62. var participantes = puntuaciones.length;
  63. var posicion;
  64.  
  65.  
  66. for(posicion = 0; posicion<= participantes; posicion++)
  67. {
  68. if(resultado != posicion)
  69. {
  70.  
  71. }
  72.  
  73. }
  74.  
  75. }