Bonjour,
Un textbox qui :
1. si contient du texte induit un checkbox coché
2. si ne contient rien induit un checkbo non coché

Après recherche et codage, j'ai :
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<html>
   <head>
      <title>EAU</title>
      <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
      <link rel="stylesheet" type="text/css" href="css.css" /> 
   </head>
   <script type="text/javascript"><!--
      function radio_nomDuLaboratoireAction (_f)
      {
         if( !_f.document.getElementById('radio_nomDuLaboratoire').checked ) _f.document.getElementById('texte_nomDuLaboratoire').value = "";
      }
      function radio_nomDuLaboratoireSaisie (_f)
      {
         var valeur = _f.document.getElementById('texte_nomDuLaboratoire').value;
         if( valeur.length == 0 )
            _f.document.getElementById("radio_nomDuLaboratoire").checked = "false";
         else
            _f.document.getElementById("radio_nomDuLaboratoire").checked = "true";
      }
 
      function timer() {
         radio_nomDuLaboratoireSaisie(document.forms["denombrement"]);
         setTimeout("timer()", 3000);
      }
   --></script>
   <body background="" style="margin:0px;" onload="timer();">
      <form name="denombrement">
         <a name="_top"></a>
         <table bgcolor="white" style="border: 0px solid black;" align="center" border="0" cellpadding="0" cellspacing="0" width="800">
            <!-- ****************************** zone riche ****************************** -->
            </tr>
               <td style="background-color:#ECEEF6;" valign="Top">
                  <h1>Donn&eacute;es de tra&ccedil;abilit&eacute; &amp; de calcul</h1>
                  <fieldset style="WIDTH:100%; border:0px solid Black;">
                  <table width=100% border=1>
                  <tr>
                  <td width=5%></td>
                  <td width=5% align=center>
                  <input type="checkbox" id="radio_nomDuLaboratoire" onclick="radio_nomDuLaboratoireAction(this.form);" style="vertical-align: middle" />
                  </td>
                  <td width=40% align=Right>Nom du laboratoire&nbsp;</td>
                  <td width=40% align=center><input type="text" id="texte_nomDuLaboratoire" onChange="" maxlength=50 style="vertical-align: middle; width: 100%" /></td>
                  <td width=5%></td>
                  </tr>
                  </table>
                  </fieldset>
                  <br>
               </td>
            </tr>
         </table>
         <a name="_bottom"></a>
      </form>
   </body>
</html>
Le but est bien entendu de surveiller (fonction timer()) le texte contenu dans le textebox et de cocher ou décocher automatiquement si il y a du texte ou non.
Sauf que toutes les 3 secondes (délibérément long pour le voir, je le placerai à 100ms) le checkbox se coche même si le textbox n'a pas de contenu,

Merci par avance