Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/06/2010, 06:33
DavidBL
 
Fecha de Ingreso: diciembre-2009
Ubicación: España
Mensajes: 380
Antigüedad: 15 años
Puntos: 1
Exclamación Ordenado, en vez de aleatorio

Hola tengo un codigo que muestra una serie de cosas aleatoriamente, como se podria hacer para que fuese ordenado?
Dentro del head:
Cita:
<script language="JavaScript">
var video=new Array()
video[0] = '<object width="660" height="405"><param name="movie" value="http://www.youtube.com/v/d611hmkk_uY&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/d611hmkk_uY&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="405"></embed></object>';
video[1] = '<object width="660" height="405"><param name="movie" value="http://www.youtube.com/v/0zBclMiMZEY&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/0zBclMiMZEY&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="405"></embed></object>';
video[2] = '<object width="660" height="405"><param name="movie" value="http://www.youtube.com/v/FPZxR9E8an0&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/FPZxR9E8an0&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="405"></embed></object>';
video[3] = '<object width="660" height="405"><param name="movie" value="http://www.youtube.com/v/Z6W75bm8S70&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Z6W75bm8S70&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="405"></embed></object>';
video[4] = '<object width="660" height="405"><param name="movie" value="http://www.youtube.com/v/xEqHSp8Jqok&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/xEqHSp8Jqok&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="405"></embed></object>';
video[5] = '<object width="658" height="405"><param name="movie" value="http://www.youtube.com/v/xatHxSiTSWg&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/xatHxSiTSWg&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="405"></embed></object>';
video[6] = '<object width="660" height="525"><param name="movie" value="http://www.youtube.com/v/zUJiU-o_kEk&hl=es_ES&fs=1&rel=0&color1=0x234900&color2=0 x4e9e00&hd=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/zUJiU-o_kEk&hl=es_ES&fs=1&rel=0&color1=0x234900&color2=0 x4e9e00&hd=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="525"></embed></object>';
video[7] = '<object width="660" height="525"><param name="movie" value="http://www.youtube.com/v/nrTiuKUPbpg&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/nrTiuKUPbpg&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="525"></embed></object>';
video[8] = '<object width="660" height="525"><param name="movie" value="http://www.youtube.com/v/j7Ve-g1Zqp0&hl=es_ES&fs=1&rel=0&color1=0x234900&color2= 0x4e9e00&hd=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/j7Ve-g1Zqp0&hl=es_ES&fs=1&rel=0&color1=0x234900&color2= 0x4e9e00&hd=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="525"></embed></object>';
video[9] = '<object width="660" height="525"><param name="movie" value="http://www.youtube.com/v/Q5XbLyCCs-g&hl=es_ES&fs=1&rel=0&color1=0x234900&color2=0x4e9 e00&hd=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Q5XbLyCCs-g&hl=es_ES&fs=1&rel=0&color1=0x234900&color2=0x4e9 e00&hd=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="525"></embed></object>';
video[10] = '<object width="660" height="525"><param name="movie" value="http://www.youtube.com/v/2zWZ-2B83Yo&hl=es_ES&fs=1&rel=0&color1=0x234900&color2= 0x4e9e00&hd=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/2zWZ-2B83Yo&hl=es_ES&fs=1&rel=0&color1=0x234900&color2= 0x4e9e00&hd=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="525"></embed></object>';
video[11] = '<object width="660" height="525"><param name="movie" value="http://www.youtube.com/v/6SCK8KXvDcY&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/6SCK8KXvDcY&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="525"></embed></object>';
video[12] = '<object width="660" height="525"><param name="movie" value="http://www.youtube.com/v/l57iLd6y1NE&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/l57iLd6y1NE&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="525"></embed></object>';
video[13] = '<object width="660" height="525"><param name="movie" value="http://www.youtube.com/v/gHbZwDfi198&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/gHbZwDfi198&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="525"></embed></object>';
video[14] = '<object width="660" height="525"><param name="movie" value="http://www.youtube.com/v/3Xn8UXqgVWo&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/3Xn8UXqgVWo&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="525"></embed></object>';
video[15] = '<object width="660" height="525"><param name="movie" value="http://www.youtube.com/v/WkUJZCyk4AU&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/WkUJZCyk4AU&hl=es_ES&fs=1&rel=0&color1=0x234900&co lor2=0x4e9e00&hd=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="525"></embed></object>';
video[16] = '<object width="640" height="505"><param name="movie" value="http://www.youtube.com/v/K39DzmzL9xI&hl=es_ES&fs=1&rel=0&color1=0x5d1719&co lor2=0xcd311b"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/K39DzmzL9xI&hl=es_ES&fs=1&rel=0&color1=0x5d1719&co lor2=0xcd311b" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="505"></embed></object>';
var F = video.length;
var aleatorio=Math.round(Math.random()*(F-1));
function mostrarvideo(){
document.write(video[aleatorio]);
}
</script>
Y dentro de body:
Cita:
<script language="JavaScript">
mostrarvideo();
</script>

<input type="button" value="Otro video" onclick="javascript:window.location.reload();"/>

Espero que alguien me ayude, muchas gracias :D

Última edición por DavidBL; 16/06/2010 a las 06:42