<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function go_to(Random link) {
window.location=Random link;
}
function rand_link() {
var a;
a = 1+Math.round(Math.random()*2); // a = random number between 1-3
if (a==m1) go_to("Cape Fear");
if (a==m2) go_to("The Good, the Bad and the Ugly");
if (a==m3) go_to("The Omen");
}
// End -->
</SCRIPT>
<BODY>
<FORM NAME="myForm">
<SELECT NAME="mylist" onChange="disp_text()">
<OPTION VALUE="m1">Cape Fear
<OPTION VALUE="m2">The Good, the Bad and the Ugly
<OPTION VALUE="m3">The Omen
<OPTION VALUE="m4">The Godfather
<OPTION VALUE="m5">Forrest Gump
</SELECT>
<INPUT TYPE="button" NAME="myButton" VALUE="Random link"
onClick="rand_link()">
</FORM>
</body>
je voudrais au hasarderreur de syntaxe ECMAScript aléatoire
<OPTION VALUE="m1">Cape Fear
<OPTION VALUE="m2">The Good, the Bad and the Ugly
<OPTION VALUE="m3">The Omen
<OPTION VALUE="m4">The Godfather
<OPTION VALUE="m5">Forrest Gump
ci-dessus syntaxe comment puis-je corriger mon code? ma question est comment faire une liste aléatoire par le bouton @ _ @. J'ai essayé de modifier quelques temps :(
Bonjour et bienvenue sur StackOverflow! S'il vous plaît modifier votre question l'ajout des points suivants peut vous apporter de meilleures réponses: 1. Qu'est-ce que vous essayez d'accomplir ("liste aléatoire par bouton" - ordre? sélectionner? supprimer? autre chose?)? 2. Qu'avez-vous essayé jusqu'à présent? 3. Quels résultats avez-vous obtenus? 4. En quoi cela diffère-t-il des résultats que vous attendiez? (veuillez être plus précis, cela ne va pas de soi dans l'état actuel de votre question) – Piskvor