hello,
I have a problem with this piece of code. I want to open a random web page
each time and remember which one has been opened before because I don´t want
to repeat. It works fine the first 3 or 4 times, but after that, it gets
collapsed and i have to close the window. Any advice?
<script language="javas cript">
// numero de ejercicios que componen todo. all the exercises
var numero_de_ejerc icios=10;
// ejercicios ya salidos showed exercises
var ej_salidos=new Array(numero_de _ejercicios);
for (var i=0; i<ej_salidos.le ngth;i++)
{ ej_salidos[i]=0;}
function ej_aleat(maximo ,salidos){
var azar=100;
var ej_salido=0;
// repite mientras salga el 0, uno mayor que no exista o uno repetido
// repites while num_ej=0 (that page doesn´t exists), num_ej greater than
max number of exercise o i get one repeated
do{
var num_ej=Math.flo or(azar*Math.ra ndom());
if(salidos[num_ej]==1)
{ej_salido=1}
}
while(((num_ej> maximo)||(num_e j==0))||(ej_sal ido==1));
if(num_ej<100){
var dir='ejercicio0 0'+num_ej+'.htm '}
else if (num_ej>99){
var dir='ejercicio' +num_ej+'.htm'}
else{
var dir='ejercicio0 '+num_ej+'.htm' }
window.open(dir );
ej_salidos[num_ej]=1;
}
</script>
<h3 class="ejercici o"><a href="#"
onClick='ej_ale at(numero_de_ej ercicios,ej_sal idos);'>Ejercic ios
aleatorios.</a> </h3>
I have a problem with this piece of code. I want to open a random web page
each time and remember which one has been opened before because I don´t want
to repeat. It works fine the first 3 or 4 times, but after that, it gets
collapsed and i have to close the window. Any advice?
<script language="javas cript">
// numero de ejercicios que componen todo. all the exercises
var numero_de_ejerc icios=10;
// ejercicios ya salidos showed exercises
var ej_salidos=new Array(numero_de _ejercicios);
for (var i=0; i<ej_salidos.le ngth;i++)
{ ej_salidos[i]=0;}
function ej_aleat(maximo ,salidos){
var azar=100;
var ej_salido=0;
// repite mientras salga el 0, uno mayor que no exista o uno repetido
// repites while num_ej=0 (that page doesn´t exists), num_ej greater than
max number of exercise o i get one repeated
do{
var num_ej=Math.flo or(azar*Math.ra ndom());
if(salidos[num_ej]==1)
{ej_salido=1}
}
while(((num_ej> maximo)||(num_e j==0))||(ej_sal ido==1));
if(num_ej<100){
var dir='ejercicio0 0'+num_ej+'.htm '}
else if (num_ej>99){
var dir='ejercicio' +num_ej+'.htm'}
else{
var dir='ejercicio0 '+num_ej+'.htm' }
window.open(dir );
ej_salidos[num_ej]=1;
}
</script>
<h3 class="ejercici o"><a href="#"
onClick='ej_ale at(numero_de_ej ercicios,ej_sal idos);'>Ejercic ios
aleatorios.</a> </h3>
Comment