bonjour,
je cherche à obtenir plusieurs résultats ou n résultat différents à partir d'une fonction mais je ne trouve pas comment faire pour la boucle.
voici le code :
***********************************************************************************
<html>
<head>
<title></title>
</head>
<body bgcolor="#C0C0C0">
<script>
function genere()
{
var a = Math.round(Math.random()*48+1);
var b = Math.round(Math.random()*48+1);
var c = Math.round(Math.random()*48+1);
var d = Math.round(Math.random()*48+1);
var e = Math.round(Math.random()*48+1);
var f = Math.round(Math.random()*48+1);
var x = new Array ( a,b,c,d,e,f);
if((x[0] == x[1]) || (x[0] == x[2]) || (x[0] == x[3]) || (x[0] == x[4]) || (x[0] == x[5]) ||
(x[1] == x[2]) || (x[1] == x[3]) || (x[1] == x[4]) || (x[1] == x[5]) ||
(x[2] == x[3]) || (x[2] == x[4]) || (x[2] == x[5]) ||
(x[3] == x[4]) || (x[3] == x[5]) ||
(x[4] == x[5]) || (x[5] == x[4]))
genere();
n1=x[0];
n2=x[1];
n3=x[2];
n4=x[3];
n5=x[4];
n6=x[5];
if ((n1==n2 || n1==n3 || n1==n4 || n1==n5 || n1==n6
|| n2==n3 || n2==n4 || n2==n5 || n2==n6
|| n3==n4 || n3==n5 || n3==n6
|| n4==n5 || n4==n6
|| n5==n6))
{
genere();
}
else
{
affich= a+" "+b+" "+c+" "+d+" "+e+" "+f ;
document.getElementById("resul1").innerHTML= affich;
}
}
</script>
<input type="button" value="Bouton" name="bnom" onclick="genere()">
<form name='f'><table border="0" width="">
<tr>
<td id="resul1" width=""></td>
</tr>
</table></form>
</body>
</html>
*************************************************************************
merci d'avance