Ya t-il une erreur dans le code?

Fermé
COOL - Modifié par pijaku le 18/06/2014 à 12:07
animostab Messages postés 2829 Date d'inscription jeudi 10 mars 2005 Statut Membre Dernière intervention 11 novembre 2019 - 18 juin 2014 à 13:44
Bonjour, je voudrai sur une page afficher des données au clic de la souris grâce à javascript mais ca ne marche. voici donc mon code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
body {
background-image: url(Best-Desktop-PC-Configuration1.jpg);
}
#entrer{
display:none;
}
#info{
display:none;
}
#stat{
display:none;
}
</style>
<head>
<title>SUPER ESSAI4444</title>
<script language="javascript" type="text/javascript">
function afficher(elem)
{
appel=new Array('entrer','info','stat');
for(i=0; i< appel.length; i++)
document.getElement.ById(appel[i]).style.display='none';
document.getElement.ById(elem).style.display='block';
}
</script>
</head>
<body>
<div id="entrer">
NOM:<br>
<input type="text" name="nom"><br>
PROMOTION:<br>
<input type="text" name="prom"><br>
<input type="submit" value="ENGISTRER">
</div>
<div id="info">
Vous devez vous enresgistrer pour avant de pouvoir continuer
</div>
<div id="stat">
les statistiques à la prochaine!
</div>
<div id="quoi">
<a href="javascript:void(0);" onclick="afficher('entrer')">ENREGISTRER</a>
<a href="javascript:void(0);" onclick="afficher('info')">INFORMATIONS</a>
<a href="javascript:void(0);" onclick="afficher('stat')">SAT</a>
</div>
</body>
</html>
A voir également:

1 réponse

animostab Messages postés 2829 Date d'inscription jeudi 10 mars 2005 Statut Membre Dernière intervention 11 novembre 2019 738
18 juin 2014 à 13:44
salut

erreur
getElement.ById tu as mis un point au milieu
ecrit plutot

getElementById
0