Bonjour,
J'ai deux script l'un pour une redirection automatique:
1 2 3 4 5
| <script type="text/javascript">
<!--
window.location = "http://www.annuaire-info.com/"
//-->
</script> |
et l'autre pour un lien aléatoire:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <SCRIPT LANGUAGE="JavaScript">
function go_to(url) {
window.location=url;
}
function rand_link() {
var a;
a = 1+Math.round(Math.random()*6); // a = random number between 1-3
if (a==1) go_to("1.php");
if (a==2) go_to("2.php");
if (a==3) go_to("3.php");
if (a==4) go_to("4.php");
if (a==5) go_to("5.php");
if (a==6) go_to("6.php");
}
</SCRIPT> |
La fonction aléatoire est appeler comme suit:
<a href="javascript:rand_link()">
J'aimerais que ma fonction redirection appele ma fonction aléatoire de sorte que mon lien se fasse automatiquement aléatoirement.
Merci
Frédéric
Partager