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
| <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Champs</title>
<style type="text/css">
.champ {
border: none;
background: #D2F0FF;
width: 300px;
padding: 2px;
color: #aaaaaa;
font-style: italic;
font-size: 13px;
font-weight: bold;
font-family: Arial;
}
</style>
<script language="javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#identifiant").blur(function () {
if (this.value == "") {
this.value='Identifiant';
$("#identifiant").css({ color: "#aaa", "font-style": "italic" });
}
});
$("#identifiant").focus(function () {
if (this.value == "Identifiant") {
this.value='';
$("#identifiant").css({ color: "#67BFE1", "font-style": "normal" });
}
});
$("#pass1").focus(function () {
if ($(this).val() == "Mot de passe") {
$(this).val('');
$(this).css({
color: "#67BFE1",
fontStyle: "normal",
display: "none"
});
$("#pass2").css("display","block");
$("#pass2").focus();
}
});
$("#pass2").blur(function () {
if ($(this).val() == "") {
$(this).css("display","none");
$("#pass1").val('Mot de passe');
$("#pass1").css({
color: "#aaaaaa",
fontStyle: "italic",
display: "block"
});
$("#pass1").blur();
}
});
});
</script>
</head>
<body>
<form name="form1" id="form1" method="post" action="#">
<p><input type="text" id="identifiant" class="champ" value="Identifiant" /></p>
<div id="passcontain">
<input type="text" id="pass1" class="champ" style="display:block;" value="Mot de passe" />
<input type="password" id="pass2" class="champ" style="display:none;" value="" />
</div>
</form>
</body>
</html> |