Voici le code source de la page solution
<html>
<head>
<meta http-equiv= »Content-Type » content= »text/html; charset=utf-8″>
<title>boutons et Javascript</title><script language= »JavaScript » type= »text/JavaScript »>
function aller_au_site (num)
{
// rappel : la 1er case du tableau porte le no ‘0’
sites = [‘http://www.w3c.org’, ‘http://www.w3schools.com’, ‘http://www.microsoft.com’];
// on utilise la methode href de ‘location’
// qui permet de changer l’adresse du navigateur
window.location.href = sites[num];
}
</script></head>
<body>
<table border= »0″ celppading= »0″ cellspacing= »0″>
<tr>
<th align= »center »>Vous allez ou ?</th>
</tr>
<tr>
<td align= »center »>
<input type= »button » name= »bouton0″ value= »site du W3C » onclick= »aller_au_site(0) »>
</td>
</tr>
<tr>
<td align= »center »>
<input type= »button » name= »bouton1″ value= »Site de W3 schools » onclick= »aller_au_site(1) »>
</td>
</tr>
<tr>
<td align= »center »>
<input type= »button » name= »bouton2″ value= »Site Microsoft » onclick= »aller_au_site(2) »>
</td>
</tr></table>
</body>
</html>