Bonjour,

J'essaye de vérifier si javascript est activé ou pas mais j'ai tout le l'erreur :
document.getElementById("choix") is null
http://10.0.0.9/test.html
Line 29

Si javascript activé je n'affiche pas le div qui a pour ID "choix"

Avez-vous une idée svp ?

Merci beaucoup pour votre aide

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
29
30
31
32
33
34
35
36
37
 
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
<style>
#form2{
  display:none;
}
 
</style>
 
<script type="text/javascript">
if (document.cookie){
  document.getElementById('choix').style.display="none";
}
</script>
 
</head>
<body>
 
  <form id="form1">
    <input type="text" />
  </form>
 
  <form id="form2">    
    <input type="text" />
  </form>
 
  <div id="choix">
    <label><input type="radio" id="live" name="choix" value="live" />live</label>
    <label><input type="radio" id="live2" name="choix" value="live2" />live2</label>
  </div>
 
</body>
</html>