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 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Formulaire, fieldset et DOM</title>
<style type="text/css">
<!--
/* ------------------------------------------
/* Typographie generale (style transversaux)
/* ------------------------------------------ */
html { font-size: 100%; } /* Cf.: http://lesite.net/pompe/definir-des-tailles-de-polices-en-CSS/ */
body { font-size: 0.8125em; font-family: verdana, "Luxi sans", "Lucida Grande", Lucida, "Lucida Sans Unicode", sans-serif; color: #333; }
/* ------------------------------------------
/* Habillage des formulaires
/* ------------------------------------------ */
input, select, textarea { font-size: 12px; font-family: inherit; padding: 5px; }
/* ------------------------------------------
/* Habillage des formulaires
/* ------------------------------------------ */
input, select, textarea { font-size: 12px; font-family: inherit; padding: 5px; }
/* Structure generale des formulaires
----------------------------------------------- */
.formulaire {}
.formulaire form {
/* margin: 0; padding: 0; Bug IE/Win
background-color:#FAFAFA;*/
padding:10px;
width: 920px;
margin:10px auto;
}
/* Fieldset */
.formulaire fieldset {
padding:20px;
margin-bottom:10px;
-moz-border-radius:10px;
-webkit-border-radius:10px;
behavior:url(border-radius.htc);
background:#ddd;
padding-bottom: 20px;
}
.formulaire fieldset legend {
/* Preciser la couleur des legend et du fond pour IE/Win */
background-color: #A70A1C;
color:#FFF;
font-weight:bold;
font-size: 18px;
text-transform: uppercase;
padding: 10px;
}
.formulaire fieldset fieldset { margin-top: 1em; }
.formulaire fieldset fieldset legend { font-size: 1em; font-weight: normal;text-transform: uppercase; }
/* Explications */
.formulaire .explication { margin: 0.50em 0; color: #444; }
/* Lignes */
.formulaire ul { margin: 0; padding: 0; list-style: none; }
.formulaire ul li { clear: both; margin: 0; padding: 0.50em 0; }
.formulaire ul li p .box {
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
behavior:url(border-radius.htc);
background: #33CCFF;
font-style: italic;
font-size: 11px;
color: #fff;
background:#86c342; color:#000;
}
/* Labels */
.formulaire label {
display:block;
width:150px;
float:left;
text-align:left;
padding-right:5px;
clear : both;
color: ;
font-weight: normal;
/* pour IE/Win */ position: relative;
}
.formulaire li p { margin-top: 0; margin-bottom: 0; }
.formulaire .choix label{display:inline;}
.formulaire .choix input.radio,
.formulaire .choix input.checkbox {width:auto;}
/* Champs de saisie */
.formulaire input.text {
width: 200px;
border: 1px inset;
border: 1px solid #26a1ce;
}
.formulaire textarea {
width: 240px;
height: 70px;
margin-right:10px;
border: 1px inset;
}
.formulaire select { width: 400px;margin-right:10px; }
.formulaire .date { width: 100px; }
.formulaire .region { width: 200px; }
.formulaire .poste { width: 650px; }
/* Boutons */
.formulaire .boutons { clear: both; margin: 0; padding: 0; text-align: center; }
.formulaire .boutons input { margin-left: 1em; }
.formulaire .boutons input, input.submit {
cursor:pointer;
width:100px;
background-color: #A70A1C;
color:#FFF;
font-weight: bold;
border: 0px;
}
input, select, textarea {
border: 1px solid #26a1ce;
}
label.oblig {
font-weight: normal; /*Mise en évidence des champs obligatoires */
}
.legende { /*Mise en forme des aides contextuelles */
font-style: italic;
color: #666;
background: transparent;
margin: 0;
padding: 0;
}
.formulaire input.mat1 {
width: 165px;
}
.formulaire input.mat2 {
width: 10px;
}
.formulaire input.mat4 {
width: 30px;
}
-->
</style>
</head>
<body>
<div class="formulaire">
<form action="#" method="post">
<p><em>* Champs obligatoires</em></p>
<fieldset id="one">
<legend>Informations personnelles</legend>
<ul>
<li>
<label for="nom" class="oblig" title="Veuillez saisir votre nom en lettres majuscules">*Nom:</label>
<input type="text" name="nom" id="nom" class="text" />
</li>
<li>
<label for="prenom" class="oblig" title="Veuillez saisir votre prénom">*Prénom:</label>
<span class="erreur_message"></span>
<input type="text" name="prenom" id="prenom" class="text" />
</li>
<li>
<label for="sexe" class="oblig">*Sexe:</label>
<input type="radio" name="sexe" id="sexe" value="1" class="radio" checked="checked" />Masculin <input type="radio" name="sexe" value="2" class="radio" />Féminin
</li>
<li>
<label for="integre" class="oblig">*vous êtes :</label>
<input type="radio" name="integre" id="integre" value="1" class="radio" onclick='getMatricule(this.value);' checked="checked" />Intégré <input type="radio" name="integre" value="2" class="radio" onclick='getMatricule(this.value);' />en cours d'intégration
</li>
</ul>
<div id="integration">
</div>
<ul>
<li>
<label for="email" title="Veuillez saisir votre adresse email">Email:</label>
<input type="text" name="email" id="email" class="text" />
</li>
<li>
<label for="telephone" title="Veuillez saisir votre numéro de téléphone">Téléphone :</label>
<span class="erreur_message"></span>
<input type="text" name="telephone" id="telephone" class="text" />
</li>
</ul>
</fieldset>
<p class="boutons"><input type="submit" value="» Validez ici" class="submit" /></p>
</form>
</div>
<script type="text/javascript">
<!--
function addEvent(obj, type, fn){
if (obj.addEventListener) obj.addEventListener(type, fn, false);
else if(obj.attachEvent){
obj["e"+type+fn] = fn;
obj[type+fn] = function(){obj["e"+type+fn](window.event);}
obj.attachEvent("on"+type, obj[type+fn]);
}
}
function vider(event){
var node_source = (document.all)?event.srcElement:event.target;
node_source.value = '';
}
function majuscule(event){
var node_source = (document.all)?event.srcElement:event.target;
node_source.value = node_source.value.toUpperCase();
}
function getMatricule(oData){
var container = document.getElementById('integration');
container.innerHTML = '';
var ul = document.createElement("ul");
var li = document.createElement("li");
li.className="choix";
var label = document.createElement("label");
label.setAttribute("for","mat1");
label.className="oblig";
var labeltexte = document.createTextNode("*Matricule :");
var span = document.createElement("span");
span.id = "erreur_message_mat";
var div = document.createElement("div");
//alert(oData);
if(oData==1){
//alert('integré oui');
var mat1 = document.createElement("input");
mat1.id = "mat1";
mat1.name = "mat1";
mat1.value = "650830";
mat1.setAttribute("maxLength",6);
mat1.setAttribute("size",6);
mat1.className='text mat1';
addEvent(mat1,'focus',vider);
//addEvent(mat1,'keypress',chiffres);
//addEvent(mat1,'keyup',verifMat1);
var tiret6 = document.createTextNode(" - ");
var mat2 = document.createElement("input");
mat2.id = "mat2";
mat2.name = "mat2";
mat2.value = "Y";
mat2.setAttribute("maxLength",1);
mat2.setAttribute("size",1);
mat2.className='text mat2';
addEvent(mat2,'focus',vider);
addEvent(mat2,'change',majuscule);
var span2 = document.createElement("span");
span2.className='legende';
var texte = document.createTextNode(' Ex pour 650830-Y');
span2.appendChild(texte);
div.appendChild(mat1);
div.appendChild(tiret6);
div.appendChild(mat2);
div.appendChild(span2);
}
else if(oData==2){
//alert('integré non');
var mat3 = document.createElement("input");
mat3.type = "hidden";
mat3.id = "mat3";
mat3.name = "mat3";
mat3.value = "ECI";
var mat4 = document.createElement("input");
mat4.type = "text";
if(document.all) mat4.className='text mat4';
else mat4.setAttribute("class","text mat4");
mat4.value = "ECI";
mat4.setAttribute("disabled","disabled");
var span2 = document.createElement("span");
span2.className='legende';
var texte = document.createTextNode(' car vous êtes en cours d\'intégration');
span2.appendChild(texte);
div.appendChild(mat3);
div.appendChild(mat4);
div.appendChild(span2);
}
label.appendChild(labeltexte);
li.appendChild(label);
li.appendChild(span);
li.appendChild(div);
ul.appendChild(li);
container.appendChild(ul);
}
//Chargement de la page...
function womOn(){
window.onload = womGo;
}
function womGo(){
for(var i = 0;i < woms.length;i++)
eval(woms[i]);
}
function womAdd(func){
woms[woms.length] = func;
}
var woms = new Array();
//onload function
//womAdd('document.getElementById("nom").focus()');
womAdd('getMatricule(1)');
womOn();
//Ton JS
document.getElementById('one').style.height="auto";
// -->
</script>
</body>
</html> |
Partager