Boucle avec la fonction setTimeout
Bonjour
Je voudrais utiliser la fonction setTimeout pour raffraichir une page toutes les xx minutes mais apparemment ma boucle while ne fonctionne pas voici mon code ci-dessous, si quelqu un a une idée, je vous remercie. a bientot.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| <html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>Reload</title>
<script language="JavaScript">
function main()
{
F1 = window.open("http://www.gulliver.com","fenetre1");
}
function boucle()
{
var speed = 6000;
var qu = 30;
function reload() {location = F1};
while (qu > 0) {
setTimeout("reload()", speed);
qu --
}
}
</script>
</head>
<body>
<h2 align="center">version reload</h2>
<p><a href="JavaScript:main();">Lancer le programme</a></p>
<p><a href="Javascript:boucle()" target="fenetre1">reloader ma page</a></p>
</body>
</html> |