|
|
|
|
Bjr
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xml:lang="fr" lang="fr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <style> * { font-family : arial; font-size : 10pt; } td { padding-left : 2px; padding-right : 2px; } pre { margin : 0px; padding : 1px; } .rowA { background-color : #F0F0FF; width: 50px; white-space: nowrap; } .rowB { background-color : #F9F9F9; width: 50px; white-space: nowrap; } input { display : inline; } </style> <script type="text/javascript"> <!-- // Objet pour construire et manipuler les grilles (table HTML) avec DOM function Grid() { this.colCount = 0; this.rowCount = 0; this.table = null; this.tableBody = null; this.tableId = ""; } // Efface la ligne spécifiée par rowIndex Grid.prototype.deleteRow = function(rowIndex) { if (rowIndex < this.rowCount) { // recherche la ligne de tableau var row = this.tableBody.getElementsByTagName("tr")[rowIndex]; // Supprime la ligne this.tableBody.removeChild(row); this.rowCount--; } } // Ajoute une ligne à la position rowIndex dans la table HTML Grid.prototype.createRow = function(rowIndex) { var row = document.createElement("tr"); for(var colIndex = 0; colIndex < this.colCount; colIndex++) { // Crée un élément <td> var cell = document.createElement("td"); cell.className=this.getCellClass(rowIndex,colIndex); // Demande au DataProvider de fournir le contenu à afficher dans la cellule cell.innerHTML = this.getCellData(rowIndex,colIndex); row.appendChild(cell); } if (rowIndex == this.rowCount) { // ajoute la ligne à la fin du corps du tableau this.tableBody.appendChild(row); } else { // recherche la ligne de tableau var rowNode = this.tableBody.getElementsByTagName("tr")[rowIndex]; this.tableBody.insertBefore(row,rowNode); } this.rowCount++; } // Ajouter une ligne à la fin Grid.prototype.addRow = function() { this.createRow(this.rowCount); } // Insère à la position rowIndex Grid.prototype.insertRow = function(rowIndex) { this.createRow(rowIndex); } // Création dynamique des lignes dans la table et chargement de chaque cellule Grid.prototype.setRowCount = function(rowCount) { if (rowCount > this.rowCount) { var startRowIndex = this.rowCount; for( var rowIndex = startRowIndex; rowIndex < rowCount; rowIndex++) { this.createRow(rowIndex); } } } // retourne l'élément TD html corrrepondant à la cellule qui se trouve en [rowIndex,colIndex] Grid.prototype.getCell = function(rowIndex,colIndex) { var row = this.tableBody.getElementsByTagName("tr")[rowIndex]; return row.getElementsByTagName("td")[colIndex]; } // Initialise la grille puis la charge en demandant au dataProvider de fournir le contenu de chaque cellule Grid.prototype.init = function(tableId,rowCount,colCount) { this.tableId = tableId; this.table = document.getElementById(tableId); this.colCount = colCount; this.tableBody = document.createElement("tbody"); // place <tbody> dans l'élément <table> this.table.appendChild(this.tableBody); this.setRowCount(rowCount); } Grid.prototype.getCellData = function(rowIndex, colIndex) { if (typeof(this.onGetCellData) == "function") { return this.onGetCellData(rowIndex, colIndex); } else { return " "; } } Grid.prototype.getCellClass = function(rowIndex, colIndex) { if (typeof(this.onGetCellClass) == "function") { return this.onGetCellClass(rowIndex, colIndex); } else { return ""; } } // --> </script> <script type="text/javascript"> <!-- // création d 'un objet de type Grid (en fait une table HTML) var grille=new Grid(); // Gestionnaires d'événements // Lorsque la grille demande le contenu de la cellule grille.onGetCellData =function(rowIndex, colIndex) { var id="cb_"+rowIndex+"_"+colIndex; return colIndex+'<input type="checkbox" id="'+id+'" onclick="grille.onClickCheckbox(\''+rowIndex+'\',\''+colIndex+'\')">'; } // Lorsque la grille demande le style css a utilisé pour la cellule grille.onGetCellClass =function(rowIndex, colIndex) { return (rowIndex % 2) ? "rowA" : "rowB"; } grille.onClickCheckbox = function(rowIndex, colIndex) { var cb = document.getElementById("cb_"+rowIndex+"_"+colIndex); var input_total = document.getElementById("total"); var total = 0; total = parseInt(input_total.value); if (isNaN(total)) { total = 0; } if (cb.checked) { total = total + 15; } else { total = total - 15; } input_total.value = total; } function go() { // Initialise la grille grille.init('ma_grille',1,48); } // --> </script> </head> <body onload="go()"> <form> <div><table id="ma_grille" border="1" cellspacing="0"></table></div> <br /> Total <input type="text" id="total"> </form> </body> </html> PhP Il y a 10 types de personnes dans le monde : ceux qui comprennent le binaire et les autres ... |
Si sii j'utilise php....par contre la je ne compren pas tro ton script :s je v te montrer le mien tu me dira ske ten pens...
|
Oky docky
<html>
<head>
<title>Untitled</title>
</head>
<body bgcolor="darksalmon">
<form name="form1" method="post" action="compteur.php">
<center><table border="2">
<?php
$nbJoursMois = date('t');
$jour = date('d');
$mois = date('m');
$annee = date('Y');
$users=array();
$users[]="Agnes";
$users[]="Brigitte";
?>
<tr>
<td><b>Date/Heure</b></td>
<td COLSPAN=4><b>8h</b></td>
<td COLSPAN=4><b>9h</b></td>
<td COLSPAN=4><b>10h</b></td>
<td COLSPAN=4><b>11h</b></td>
<td COLSPAN=4><b>12h</b></td>
<td COLSPAN=4><b>13h</b></td>
<td COLSPAN=4><b>14h</b></td>
<td COLSPAN=4><b>15h</b></td>
<td COLSPAN=4><b>16h</b></td>
<td COLSPAN=4><b>17h</b></td>
<td COLSPAN=4><b>18h15</b></td>
<td><b>Compteur</b></td>
</tr>
<?php
for( $jour = 1; $jour < $nbJoursMois+1; $jour++)
{ // Là on s'occupe de la 1ère ligne du cycle de 3
$datejour=sprintf("%02s/%02s/%02s",$jour,$mois,$annee); // On affiche la date
printf('<tr><td><b>%s</b></td></tr>',$datejour); // On affiche la date
for ($u=0; $u < count($users); $u++)
{
printf("<tr><td><b>%s</b></td>\n",$users[$u]); // On affiche le prénom
for($i = 0; $i<=43; $i++)
{
$id="users[".$users[$u]."][".$datejour."][".$i."]";
printf("<td><input type=\"checkbox\" id=\"%s\" name=\"%s\"></td>\n",$id,$id); // + les 11 checkbox pour arriver jusqu'au compteur
}
echo "<td><input type=\"submit\" name=\"envoyer\" value=\"envoyer\"></td>\n"; // Tu remplace aAa par ce que tu souhaite afficher :)
echo "</tr>\n";
}
}
?>
</table></center></form>
</body>
</html>
compteur.php <?php
if (isset($_POST["users"]))
{
echo "<table border=\"1\">\n";
$users=$_POST["users"];
foreach ($users as $user=>$dates)
{
foreach ($dates as $jour=>$pointages)
{
echo "<tr>\n";
printf("<td>%s</td>\n",$user);
printf("<td>%s</td>\n",$jour);
printf("<td>%s minute(s)</td>\n",count($pointages)*15);
echo "</tr>\n";
}
}
echo "</table>\n";
}
?>
La page compteur.php est ultra basique : à toi d'adapter-- PhP Il y a 10 types de personnes dans le monde : ceux qui comprennent le binaire et les autres ... |