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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
<!--le fichier html -->
<form name="monForm" >
<div class="col-lg-12 well">
<div class="row">
<div id="surf" class="col-sm-6 form-group">
<label>Nom du departement</label>
<div style="margin-bottom: 25px" class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input type="text" name="Nom_departement" id="Nom_departement" placeholder="Donner un nom à votre formation" class="form-control">
</div>
<div class="col-lg-12 well">
<div class="col-sm-6 form-group">
<label>Date d'arrivé</label>
<div style="margin-bottom: 25px" class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input type="date" name="Date_Arrive" id="Date_Arrive" placeholder="Saisir la Date d'arrivé" class="form-control">
</div>
</div>
<div class="col-sm-6 form-group">
<label>Date de depart</label>
<div style="margin-bottom: 25px" class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input type="date" name="Date_depart" id="Date_depart" placeholder="Saisir la Date de depart" class="form-control">
</div>
</div>
<div class="col-sm-6 form-group">
<label>Description de l'emplacement</label>
<div style="margin-bottom: 25px" class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input type="text" name="Description" id="Description" placeholder="Saisir le nom de l'entreprise" class="form-control">
</div></div>
<div class="col-sm-6 form-group">
<label>Critique</label>
<div style="margin-bottom: 25px" class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input type="text" name="Critique" id="Critique" placeholder="Saisir le lieu" class="form-control">
</div>
</div>
</div>
</div>
<div class="col-sm-6 form-group">
<label>Ajouter un autre departement</label>
<div class="input-group-btn">
<button class="btn btn-success" onclick="addHtmlTableRow()" type="button">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
</button>
</div>
</div>
</div>
</div>
<div>
<table id="table" class = "table table-bordered">
<thead>
<tr>
<th>Nom du departement</th>
<th>Date d'arrivé</th>
<th>Date de depart</th>
<th>Description de l'emplacement</th>
<th>Critique</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="input-group-btn">
<a <button type="button" class="btn btn-success" href="">Précédent</button></a>
<a <button type="button" class="btn btn-success" href="">Suivant</button></a>
</div> </form>
</div>
</div>
</section>
<!-- le javascript-->
<script>
function checkEmptyInput(){
var isEmpty=false,
Nom_departement=document.getElementById("Nom_departement").value,
Date_Arrive=document.getElementById("Date_Arrive").value,
Date_depart=document.getElementById("Date_depart").value
Description=document.getElementById("Description").value,
Critique=document.getElementById("Critique").value;
if(Nom_departement==""){
alert("Le Nom du departement SVP");
isEmpty=true;
}
else if(Date_Arrive==""){
alert("la Date d'arrivé SVP");
isEmpty=true;
}
else if(Date_depart==""){
alert("la Date de depart SVP");
isEmpty=true;
}
else if(Description==""){
alert("la Description de l'emplacement SVP");
isEmpty=true;
}
else if(Critique==""){
alert("Critiquez SVP");
isEmpty=true;
}
return isEmpty;
}
function addHtmlTableRow()
{
if(!checkEmptyInput()){
var table=document.getElementById("table"),
newRow=table.insertRow(table.length),
cell1=newRow.insertCell(0),
cell2=newRow.insertCell(1),
cell3=newRow.insertCell(2),
cell4=newRow.insertCell(3),
cell5=newRow.insertCell(4),
cell6=newRow.insertCell(5),
cell7=newRow.insertCell(6),
Nom_departement=document.getElementById("Nom_departement").value,
Date_Arrive=document.getElementById("Date_Arrive").value,
Date_depart=document.getElementById("Date_depart").value
Description=document.getElementById("Description").value,
Critique=document.getElementById("Critique").value;
cell1.innerHTML=Nom_departement;
cell2.innerHTML=Date_Arrive;
cell3.innerHTML=Date_depart;
cell4.innerHTML=Description;
cell5.innerHTML=Critique;
cell6.innerHTML='<button class="btn btn-success" onclick="removeRow(this)" type="button">Supprimer</button>';
cell7.innerHTML='<button class="btn btn-success" onclick="editRow(this)" type="button">Modifier</button>';
document.forms['monForm'].reset();
}
}
function removeRow(src)
{
var oRow = src.parentElement.parentElement;
document.all("table").deleteRow(oRow.rowIndex);
}
</script> |
Partager