Chiffre aleatoire

Résolu
ManuAntibes Messages postés 491 Date d'inscription mardi 24 octobre 2000 Statut Membre Dernière intervention 18 novembre 2021 - 22 juil. 2005 à 19:44
ManuAntibes Messages postés 491 Date d'inscription mardi 24 octobre 2000 Statut Membre Dernière intervention 18 novembre 2021 - 23 juil. 2005 à 08:52
Salut

J'ai une page avec deux frames la frame du haut doit afficher la page aléatoirement.
j'ai deja ecrie un truc mais ca marche pas , pouvez vous m'aider, merci .

Voici mon code :
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">


var nbimage= 50;


numimage= Math.round(Math.random()*(nbimage-1)+1);
if (numimage <= 10)
{
gotosite = "haut.htm";
}
if (numimage > 10 && numimage <= 20)
{
gotosite = "haut1.htm";
}
if (numimage > 20 && numimage <= 30)
{
gotosite = "haut2.htm";
}
if (numimage > 30 && numimage <= 40)
{
gotosite = "haut3.htm";
}
if (numimage > 40)
{
gotosite = "haut4.htm";
}
document.write ('<frameset rows="150,*" cols="*" frameborder="NO" border="0" framespacing="0">');
document.write ('<frame src=gotosite name="topFrame" scrolling="NO" noresize>');
document.write ('<frame src="ulhanetara-1.htm"></frameset>');
</script>
</head>
</html>

MANUANTIBES

2 réponses

minirop Messages postés 4 Date d'inscription vendredi 7 mai 2004 Statut Membre Dernière intervention 16 décembre 2005
22 juil. 2005 à 22:48
il faut simplement concatener la variable (toi tu l'utilise en text)
essaye en remplacent :
document.write ('<frame src=gotosite name="topFrame" scrolling="NO" noresize>');
par
document.write ('<frame src="'+gotosite+'" name="topFrame" scrolling="NO" noresize>');
voila
3
ManuAntibes Messages postés 491 Date d'inscription mardi 24 octobre 2000 Statut Membre Dernière intervention 18 novembre 2021 5
23 juil. 2005 à 08:52
Merci
ça marche super
A+

MANUANTIBES
0
Rejoignez-nous