Partage
  • Partager sur Facebook
  • Partager sur Twitter

javascript hs avec doctype sous FF

    8 janvier 2009 à 1:32:28

    Bonjour,
    sur mon site dés que je colle le doctype ma fonction de calcul dynamique ne marche plus sous FF :colere2: mais continue à fonctionner sous IE o_O . Le pb est que si j'enlève mon doctype c'est ma mise en page sous IE qui part en vrac...
    Voici mon code qui n'est pas parfait :p mais je ne maitrise pas le javascript.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <!--head de la page web-->
    <head>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <!--titre de la page web-->
    <title>La Gervondine page 1</title>
    <!--fin du titre de la page web-->
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <!--feuilles de style-->
    <link rel="stylesheet" media="screen" href="style.css" type="text/css" />
    <link rel="stylesheet" media="print" href="impression.css" type="text/css" />
    <!--fin des feuilles de style-->
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <!--caractére spécifique français-->
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!--fin du caractère spécifique français-->
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <!-- calcul dynamique du nb de repas-->
    <script type="text/javascript"> 
    function calcul()
    {
    var prix=3.80;
    var total=0;
    if (cantine.lundi10.checked)
    total +=1;
    if (cantine.mardi10.checked)
    total +=1;
    if (cantine.jeudi10.checked)
    total +=1;
    if (cantine.vendredi10.checked)
    total +=1;
    if (cantine.lundi20.checked)
    total +=1;
    if (cantine.mardi20.checked)
    total +=1;
    if (cantine.jeudi20.checked)
    total +=1;
    if (cantine.vendredi20.checked)
    total +=1;
    if (cantine.lundi30.checked)
    total +=1;
    if (cantine.mardi30.checked)
    total +=1;
    if (cantine.jeudi30.checked)
    total +=1;
    if (cantine.vendredi30.checked)
    total +=1;
    if (cantine.lundi40.checked)
    total +=1;
    if (cantine.mardi40.checked)
    total +=1;
    if (cantine.jeudi40.checked)
    total +=1;
    if (cantine.vendredi40.checked)
    total +=1;
    if (cantine.lundi50.checked)
    total +=1;
    if (cantine.mardi50.checked)
    total +=1;
    if (cantine.jeudi50.checked)
    total +=1;
    if (cantine.vendredi50.checked)
    total +=1;
    cantine.total.value = total+" ";
    cantine.nb.value = Math.round(total*prix*100)/100+" ";
    EcrireCookie("total",total);
    }
    <!--
    function EcrireCookie(nom, valeur)
    {
    var argv=EcrireCookie.arguments;
    var argc=EcrireCookie.arguments.length;
    var expires=(argc > 2) ? argv[2] : null;
    var path=(argc > 3) ? argv[3] : null;
    var domain=(argc > 4) ? argv[4] : null;
    var secure=(argc > 5) ? argv[5] : false;
    document.cookie=nom+"="+escape(valeur)+
    ((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
    ((path==null) ? "" : ("; path="+path))+
    ((domain==null) ? "" : ("; domain="+domain))+
    ((secure==true) ? "; secure" : "");
    }
    //-->
    </script>
    <!-- fin du calcul dynamique du nb de repas-->
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->	
    </head>
    <!--fin head de la page web-->
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <!--contenu de la page web-->
    <body>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <!--Zone en_tete-->
    <div class="saut">
    </div>
    <div class="center img1" title="image">
    </div>
    <!--Fin de la zone en_tete-->
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <!--Zone formulaire-->
    <div class="center">
    <form name="cantine" method="post" action="traitement.php" class="center">
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <!--passage au mois en français et calcul de la date-->
    <?php
    $mois[12]="janvier";
    $mois[1]="fevrier";
    $mois[2]="mars";
    $mois[3]="avril";
    $mois[4]="mai";
    $mois[5]="juin";
    $mois[6]="juillet";
    $mois[7]="aout";
    $mois[8]="septembre";
    $mois[9]="octobre";
    $mois[10]="novembre";
    $mois[11]="décembre";
    $moisfr=$mois[date("n")];
    $date=date ("Y");
    if ($moisfr=="janvier") 
    {
    $date1=$date+1;
    }
    else $date1=$date;
    ?>
    <!--fin du passage au mois en français et calcul de la date-->
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <h2>Mois de : <?php echo "$moisfr $date1";?></h2>
    <p>
    <label for="nom1">Nom</label>
    <input type="text" class="maj" name="nom1" id="nom1" tabindex="10" size="30" maxlength="10"/>
    <br/><br/>
    <label for="prenom1">Prénom</label>
    <input type="text" class="maj" name="prenom1" id="prenom1" tabindex="20" size="30" maxlength="15"/>
    <label for="classe1">Classe</label>
    <select name="classe1" id="classe1">
    <option value="cycle1">Maternelles</option>
    <option value="cycle2">CP/CE1</option>
    <option value="cycle3">CE2/CM1/CM2</option>
    </select>
    <br/>
    <input type="hidden" class="maj" name="prenom2" id="prenom2" value="XXXX" tabindex="20" size="30" maxlength="15"/>
    <input type="hidden" class="maj" name="classe2" id="classe2" value="XXXX" tabindex="20" size="30" maxlength="15"/>
    <br/><br/>
    <input type="hidden" class="maj" name="prenom3" id="prenom3" value="XXXX" tabindex="20" size="30" maxlength="15"/>
    <input type="hidden" class="maj" name="classe3" id="classe3" value="XXXX" tabindex="20" size="30" maxlength="15"/>
    </p>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <!--récupération des données-->
    <?php
    include ("connexion.php"); //appel des données de connexion
    $bdd = mysql_connect ($sqlhost,$sqlbase,$sqlpass); //connexion au serveur
    if(!$bdd) //contrôle de la connexion au serveur
    {
    echo "Désolé, connexion à" .$SQLhost. "impossible\n";
    exit;
    }
    if(!mysql_select_db($sqltable,$bdd)) //contrôle de la connexion à la base de données
    {
    echo "Désolé, connexion à" .$sqltable. "impossible\n";
    exit;
    }
    $reponse = mysql_query("SELECT * FROM fevrier") or die(mysql_error()); // Requête SQL
    $donnees = mysql_fetch_array($reponse);
    mysql_close(); // Déconnexion de MySQL
    ?>
    <!--fin de la récupération des données-->
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <table class="center">
    <tr>
    <th colspan="2">DATE</th>
    <th>ENFANT 1</th>
    <th class="large" colspan="2">Commentaires</th>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>lundi</td>
    <td><?php echo $donnees['lundi1']; ?></td>
    <td><input type="checkbox" name="lundi10" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>mardi</td>
    <td><?php echo $donnees['mardi1'];?></td>
    <td><input type="checkbox" name="mardi10" value="1" onclick="calcul()"/>
    </td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>jeudi</td>
    <td><?php echo $donnees['jeudi1'];?></td>
    <td><input type="checkbox" name="jeudi10" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>vendredi</td>
    <td><?php echo $donnees['vendredi1'];?></td>
    <td><input type="checkbox" name="vendredi10" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td></td>
    <td></td>
    <td></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>lundi</td>
    <td><?php echo $donnees['lundi2'];?></td>
    <td><input type="checkbox" name="lundi20" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>mardi</td>
    <td><?php echo $donnees['mardi2'];?></td>
    <td><input type="checkbox" name="mardi20" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>jeudi</td>
    <td><?php echo $donnees['jeudi2'];?></td>
    <td><input type="checkbox" name="jeudi20" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>vendredi</td>
    <td><?php echo $donnees['vendredi2'];?></td>
    <td><input type="checkbox" name="vendredi20" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td></td>
    <td></td>
    <td></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>lundi</td>
    <td><?php echo $donnees['lundi3'];?></td>
    <td><input type="checkbox" name="lundi30" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>mardi</td>
    <td><?php echo $donnees['mardi3'];?></td>
    <td><input type="checkbox" name="mardi30" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>jeudi</td>
    <td><?php echo $donnees['jeudi3'];?></td>
    <td><input type="checkbox" name="jeudi30" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>vendredi</td>
    <td><?php echo $donnees['vendredi3'];?></td>
    <td><input type="checkbox" name="vendredi30" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td></td>
    <td></td>
    <td></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>lundi</td>
    <td><?php echo $donnees['lundi4'];?></td>
    <td><input type="checkbox" name="lundi40" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>mardi</td>
    <td><?php echo $donnees['mardi4'];?></td>
    <td><input type="checkbox" name="mardi40" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>jeudi</td>
    <td><?php echo $donnees['jeudi4'];?></td>
    <td><input type="checkbox" name="jeudi40" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>vendredi</td>
    <td><?php echo $donnees['vendredi4'];?></td>
    <td><input type="checkbox" name="vendredi40" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td></td>
    <td></td>
    <td></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>lundi</td>
    <td><?php echo $donnees['lundi5'];?></td>
    <td><input type="checkbox" name="lundi50" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>mardi</td>
    <td><?php echo $donnees['mardi5'];?></td>
    <td><input type="checkbox" name="mardi50" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>jeudi</td>
    <td><?php echo $donnees['jeudi5'];?></td>
    <td><input type="checkbox" name="jeudi50" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td>vendredi</td>
    <td><?php echo $donnees['vendredi5'];?></td>
    <td><input type="checkbox" name="vendredi50" value="1" onclick="calcul()"/></td>
    <td class="large" colspan="2"></td>
    </tr>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <tr>
    <td colspan="2">Nb repas</td>
    <td>
    <script type="text/javascript">
    document.write('<input class="total" type="text" name="total" readonly="readonly" />');
    </script>
    </td>
    <td class="large">Prix repas : 3.80 euros</td>
    <td class="large">Total : 
    <script type="text/javascript">
    document.write('<input class="total" type="text" name="nb" readonly ="readonly" />');
    </script>
    euros</td>	
    </tr>
    </table>
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <p class="center">
    <br/>
    <input type="button" value="Tout recommencer" onclick="document.location='page1.php'" />
    <input type="submit" value="Validez/Imprimez" onclick="window.print();" />
    <input type="button" value=" Retour accueil " onclick="history.back()" />
    </p>
    </form>
    </div>
    <!--Fin de la zone formulaire-->
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    <!--Pied de page-->
    <div class="center">
    <p class="souligne">Paiement par chèque à l'ordre de la Gervondine</p>
    <p class="souligne">L'association n'est pas responsable en cas de paiement en espèces dans la boite aux lettres</p>
    <p><a class="titre" href="mailto:la.gervondine@free.fr" title="la.gervondine@free.fr">LA GERVONDINE</a></p>
    <P>
    <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="CSS Valide !" />
    </p>
    <br/>
    </div>
    <!--Fin du pied de page-->
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    </body>
    <!--fin du contenu de la page web-->
    <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
    </html>
    <!--fermeture de la page html-->
    


    si vous pouviez venir à mon secour.... :-°
    Merci
    • Partager sur Facebook
    • Partager sur Twitter
      9 janvier 2009 à 18:47:55

      Salut :)

      1) Supprime ces commentaires <!-- xxxxxxxx --> , ça fait que perturber la lecture du code
      2) Il y a du PHP dans ton code : ton code entier est donc à placer entre les balises <code type="php"></code>
      3) Indente ton code
      4) Il est où le problème ? Qu'est-ce qui ne fonctionne pas correctement ? Quel résultat est attendu ? Qu'obtient-on ? Quelle fonction JavaScript est susceptible de poser ce problème ?

      PS : beaucoup de commentaires sont inutiles et ne font que perturber la lecture du code, comme "head de la page / fin head de la page" :p
      • Partager sur Facebook
      • Partager sur Twitter
        18 janvier 2009 à 15:52:00

        Désolé de cette réponse un peu tardive :-°:-°:-°
        Bon j'ai supprimé mes commentaires "abusifs" et j'ai indenté mon code du mieux que j'ai pu...
        Maintenant le pb vient du fait que j'essaye de mettre mon site au normes de la W3C, pour cela je rajoute ceci en début de ma page:
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
        

        le pb est que si je met çà mon code javascript ne fonctionne plus sous FF mais marche bien sous IE.
        Le but de ce bout de code javascript est de compter en dynamique le nb de checkbox que l'on sélectionne dans ma page.
        Quelqu'un a t il une idée du pourquoi ?
        je vous remet le code de ma page:
        <html>
        <head>
        	<title>Formulaire d'inscription</title>
        		<link rel="stylesheet" media="screen" href="style.css" type="text/css" />
        		<link rel="stylesheet" media="print" href="impression.css" type="text/css" />
        	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        	<meta http-equiv="content-language" content="fr" />
        	<meta name="robots" content="index,follow" />
        	<meta name="keywords" content="gervondine,repas cantine,feuille mensuelle d'inscription,école communale,ste anne sur gervonde" />
        	<meta name="description" content="Feuille d'inscription à la cantine de l'école communale de ste anne sur gervonde." />
        	<meta name="rating" content="general" />
        	<meta name="author" content="Poune38" />
        	<meta name="copyright" content="Copyright © 2008" />
        <!-- calcul dynamique du nb de repas-->
        <script type="text/javascript">
        function calcul()
        {
        var prix=3.80;
        var total=0;
        if (cantine.lundi10.checked)
        	total +=1;
        if (cantine.lundi11.checked)
        	total +=1;
        if (cantine.lundi12.checked)
        	total +=1;
        if (cantine.mardi10.checked)
        	total +=1;
        if (cantine.mardi11.checked)
        	total +=1;
        if (cantine.mardi12.checked)
        	total +=1;
        if (cantine.jeudi10.checked)
        	total +=1;
        if (cantine.jeudi11.checked)
        	total +=1;
        if (cantine.jeudi12.checked)
        	total +=1;
        if (cantine.vendredi10.checked)
        	total +=1;
        if (cantine.vendredi11.checked)
        	total +=1;
        if (cantine.vendredi12.checked)
        	total +=1;
        if (cantine.lundi20.checked)
        	total +=1;
        if (cantine.lundi21.checked)
        	total +=1;
        if (cantine.lundi22.checked)
        	total +=1;
        if (cantine.mardi20.checked)
        	total +=1;
        if (cantine.mardi21.checked)
        	total +=1;
        if (cantine.mardi22.checked)
        	total +=1;
        if (cantine.jeudi20.checked)
        	total +=1;
        if (cantine.jeudi21.checked)
        	total +=1;
        if (cantine.jeudi22.checked)
        	total +=1;
        if (cantine.vendredi20.checked)
        	total +=1;
        if (cantine.vendredi21.checked)
        	total +=1;
        if (cantine.vendredi22.checked)
        	total +=1;
        if (cantine.lundi30.checked)
        	total +=1;
        if (cantine.lundi31.checked)
        	total +=1;
        if (cantine.lundi32.checked)
        	total +=1;
        if (cantine.mardi30.checked)
        	total +=1;
        if (cantine.mardi31.checked)
        	total +=1;
        if (cantine.mardi32.checked)
        	total +=1;
        if (cantine.jeudi30.checked)
        	total +=1;
        if (cantine.jeudi31.checked)
        	total +=1;
        if (cantine.jeudi32.checked)
        	total +=1;
        if (cantine.vendredi30.checked)
        	total +=1;
        if (cantine.vendredi31.checked)
        	total +=1;
        if (cantine.vendredi32.checked)
        	total +=1;
        if (cantine.lundi40.checked)
        	total +=1;
        if (cantine.lundi41.checked)
        	total +=1;
        if (cantine.lundi42.checked)
        	total +=1;
        if (cantine.mardi40.checked)
        	total +=1;
        if (cantine.mardi41.checked)
        	total +=1;
        if (cantine.mardi42.checked)
        	total +=1;
        if (cantine.jeudi40.checked)
        	total +=1;
        if (cantine.jeudi41.checked)
        	total +=1;
        if (cantine.jeudi42.checked)
        	total +=1;
        if (cantine.vendredi40.checked)
        	total +=1;
        if (cantine.vendredi41.checked)
        	total +=1;
        if (cantine.vendredi42.checked)
        	total +=1;
        if (cantine.lundi50.checked)
        	total +=1;
        if (cantine.lundi51.checked)
        	total +=1;
        if (cantine.lundi52.checked)
        	total +=1;
        if (cantine.mardi50.checked)
        	total +=1;
        if (cantine.mardi51.checked)
        	total +=1;
        if (cantine.mardi52.checked)
        	total +=1;
        if (cantine.jeudi50.checked)
        	total +=1;
        if (cantine.jeudi51.checked)
        	total +=1;
        if (cantine.jeudi52.checked)
        	total +=1;
        if (cantine.vendredi50.checked)
        	total +=1;
        if (cantine.vendredi51.checked)
        	total +=1;
        if (cantine.vendredi52.checked)
        	total +=1;
        cantine.total.value = total+" ";
        cantine.nb.value = Math.round(total*prix*100)/100+" ";
        EcrireCookie("total",total);
        }
        <!--
        function EcrireCookie(nom, valeur)
        {
        var argv=EcrireCookie.arguments;
        var argc=EcrireCookie.arguments.length;
        var expires=(argc > 2) ? argv[2] : null;
        var path=(argc > 3) ? argv[3] : null;
        var domain=(argc > 4) ? argv[4] : null;
        var secure=(argc > 5) ? argv[5] : false;
        document.cookie=nom+"="+escape(valeur)+
        ((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
        ((path==null) ? "" : ("; path="+path))+
        ((domain==null) ? "" : ("; domain="+domain))+
        ((secure==true) ? "; secure" : "");
        }
        //-->
        </script>
        </head>
        <body>
        <div class="center">
        	<br/>
        		<img src="en_tete1.gif" width="750" height="65" alt ="image logo" title="Formulaire d'inscription à la cantine"  />
        <form name="cantine" method="post" action="traitement.php">
        <?php
        $mois[12]="janvier";
        $mois[1]="fevrier";
        $mois[2]="mars";
        $mois[3]="avril";
        $mois[4]="mai";
        $mois[5]="juin";
        $mois[6]="juillet";
        $mois[7]="aout";
        $mois[8]="septembre";
        $mois[9]="octobre";
        $mois[10]="novembre";
        $mois[11]="décembre";
        $moisfr=$mois[date("n")];
        $date=date ("Y");
        if ($moisfr=="janvier") 
        {
        $date1=$date+1;
        }
        else $date1=$date;
        ?>
        <h2>Mois de : <?php echo "$moisfr $date1"; ?></h2>
        <label for="nom1">Nom</label>
        	<input type="text" class="maj" name="nom1" id="nom1" tabindex="10" size="30" maxlength="10"/>
        		<br/><br/>
        <label for="prenom1">Prénom</label>
        	<input type="text" class="maj" name="prenom1" id="prenom1" tabindex="20" size="30" maxlength="15"/>
        <label for="classe1">Classe</label>
        	<select name="classe1" id="classe1">
        		<option value="cycle1">Maternelles</option>
        		<option value="cycle2">CP/CE1</option>
        		<option value="cycle3">CE2/CM1/CM2</option>
        	</select>
        		<br/><br/>
        <label for="prenom2">Prénom</label>
        	<input type="text" class="maj" name="prenom2" id="prenom2" tabindex="20" size="30" maxlength="15"/>
        <label for="classe2">Classe</label>
        	<select name="classe2" id="classe2">
        		<option value="cycle1">Maternelles</option>
        		<option value="cycle2">CP/CE1</option>
        		<option value="cycle3">CE2/CM1/CM2</option>
        	</select>
        		<br/><br/>
        <label for="prenom3">Prénom</label>
        	<input type="text" class="maj" name="prenom3" id="prenom3" tabindex="20" size="30" maxlength="15"/>
        <label for="classe3">Classe</label>
        	<select name="classe3" id="classe3">
        		<option value="cycle1">Maternelles</option>
        		<option value="cycle2">CP/CE1</option>
        		<option value="cycle3">CE2/CM1/CM2</option>
        	</select>
        		<br/><br/>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        <?php
        include ("connexion.php");
        $bdd = mysql_connect ($sqlhost,$sqlbase,$sqlpass);//connexion
        if(!$bdd)//contrôle de la connexion au serveur
        {
        echo "Désolé, connexion à" .$SQLhost. "impossible\n";
        exit;
        }
        if(!mysql_select_db($sqlbase,$bdd))//contrôle de la connexion à la base de données
        {
        echo "Désolé, connexion à" .$sqlbase. "impossible\n";
        exit;
        }
        $reponse = mysql_query("SELECT * FROM fevrier") or die(mysql_error()); // Requête SQL
        $donnees = mysql_fetch_array($reponse);
        mysql_close(); // Déconnexion de MySQL
        ?>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        <table class="center">
        	<tr>
        		<th colspan="2">DATE</th>
        		<th>ENFANT 1</th>
        		<th>ENFANT 2</th>
        		<th>ENFANT 3</th>
        		<th class="large" colspan="2">Commentaires</th>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>lundi</td>
        		<td><?php echo $donnees['lundi1']; ?></td>
        		<td><input type="checkbox" name="lundi10" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="lundi11" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="lundi12" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>mardi</td>
        		<td><?php echo $donnees['mardi1'];?></td>
        		<td><input type="checkbox" name="mardi10" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="mardi11" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="mardi12" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>jeudi</td>
        		<td><?php echo $donnees['jeudi1'];?></td>
        		<td><input type="checkbox" name="jeudi10" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="jeudi11" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="jeudi12" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>vendredi</td>
        		<td><?php echo $donnees['vendredi1'];?></td>
        		<td><input type="checkbox" name="vendredi10" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="vendredi11" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="vendredi12" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td></td>
        		<td></td>
        		<td></td>
        		<td></td>
        		<td></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>lundi</td>
        		<td><?php echo $donnees['lundi2'];?></td>
        		<td><input type="checkbox" name="lundi20" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="lundi21" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="lundi22" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>mardi</td>
        		<td><?php echo $donnees['mardi2'];?></td>
        		<td><input type="checkbox" name="mardi20" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="mardi21" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="mardi22" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>jeudi</td>
        		<td><?php echo $donnees['jeudi2'];?></td>
        		<td><input type="checkbox" name="jeudi20" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="jeudi21" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="jeudi22" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>vendredi</td>
        		<td><?php echo $donnees['vendredi2'];?></td>
        		<td><input type="checkbox" name="vendredi20" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="vendredi21" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="vendredi22" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td></td>
        		<td></td>
        		<td></td>
        		<td></td>
        		<td></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>lundi</td>
        		<td><?php echo $donnees['lundi3'];?></td>
        		<td><input type="checkbox" name="lundi30" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="lundi31" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="lundi32" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>mardi</td>
        		<td><?php echo $donnees['mardi3'];?></td>
        		<td><input type="checkbox" name="mardi30" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="mardi31" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="mardi32" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>jeudi</td>
        		<td><?php echo $donnees['jeudi3'];?></td>
        		<td><input type="checkbox" name="jeudi30" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="jeudi31" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="jeudi32" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>vendredi</td>
        		<td><?php echo $donnees['vendredi3'];?></td>
        		<td><input type="checkbox" name="vendredi30" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="vendredi31" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="vendredi32" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td></td>
        		<td></td>
        		<td></td>
        		<td></td>
        		<td></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>lundi</td>
        		<td><?php echo $donnees['lundi4'];?></td>
        		<td><input type="checkbox" name="lundi40" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="lundi41" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="lundi42" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>mardi</td>
        		<td><?php echo $donnees['mardi4'];?></td>
        		<td><input type="checkbox" name="mardi40" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="mardi41" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="mardi42" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>jeudi</td>
        		<td><?php echo $donnees['jeudi4'];?></td>
        		<td><input type="checkbox" name="jeudi40" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="jeudi41" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="jeudi42" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>vendredi</td>
        		<td><?php echo $donnees['vendredi4'];?></td>
        		<td><input type="checkbox" name="vendredi40" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="vendredi41" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="vendredi42" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td></td>
        		<td></td>
        		<td></td>
        		<td></td>
        		<td></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>lundi</td>
        		<td><?php echo $donnees['lundi5'];?></td>
        		<td><input type="checkbox" name="lundi50" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="lundi51" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="lundi52" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>mardi</td>
        		<td><?php echo $donnees['mardi5'];?></td>
        		<td><input type="checkbox" name="mardi50" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="mardi51" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="mardi52" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>jeudi</td>
        		<td><?php echo $donnees['jeudi5'];?></td>
        		<td><input type="checkbox" name="jeudi50" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="jeudi51" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="jeudi52" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td>vendredi</td>
        		<td><?php echo $donnees['vendredi5'];?></td>
        		<td><input type="checkbox" name="vendredi50" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="vendredi51" value="1" onclick="calcul()"/></td>
        		<td><input type="checkbox" name="vendredi52" value="1" onclick="calcul()"/></td>
        		<td class="large" colspan="2"></td>
        	</tr>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        	<tr>
        		<td colspan="2">Nb repas</td>
        			<script type="text/javascript">
        document.write('<td colspan="3"><input class="total" type="text" name="total" readonly/></td><td class="large">Prix repas : 3.80 euros</td><td class="large">Total : <input class="total" type="text" name="nb" readonly/>euros</td>');
        			</script>
        	</tr>
        </table>
        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
        <p>
        	<br/>
        		<input type="button" value="Tout recommencer" onclick="document.location='page3.php'">
        		<input type="submit" value="Validez/Imprimez" onclick="window.print();">
        		<input type="button" value=" Retour accueil " onclick="history.back()">
        </p>
        </div>
        </form>
        <div class="center">
        	<p><h4><u>Paiement par chèque à l'ordre de la Gervondine</u></h4></p>
        	<p><h4><u>Nous ne serons pas responsable en cas de problème sur un paeiment en liquide dans la boite aux lettres</u></h4></p>
        	<p><h1><a href="mailto:la.gervondine@free.fr" title="la.gervondine@free.fr">LA GERVONDINE</a></h1></p>
        		<br/>
        </div>
        </body>
        </html>
        


        Merci
        • Partager sur Facebook
        • Partager sur Twitter

        javascript hs avec doctype sous FF

        × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
        × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
        • Editeur
        • Markdown