nabst Posted May 4, 2008 Share Posted May 4, 2008 (edited) Salut, Sous un nom farfelue, je cherche simplement un script javascript qui me ferais l'équivalent de ça (php): <?php $var=rand(1, 2); $code1= 'script javascript 1'; $code2= 'script javascript 2'; if ( $var ==1 ) { echo $code1; } if ( $var == 2 ) { echo $code2; } ?></div> C'est à dire, un script qui execute aléatoirement l'un ou l'autre script. En connaissait vous? Merci. Edited May 4, 2008 by nabst Link to comment Share on other sites More sharing options...
Ifmy Posted May 4, 2008 Share Posted May 4, 2008 Bonjour, function f1(){...}function f2(){...}var rand = Math.round(Math.random());rand == 0 ? f1() : f2(); ça doit fonctionner Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now