Comment corriger this.value undefined ?
Bonjour ;)
ça doit être tout simple, mais je ne trouve pas pourquoi firebug me donne le message this.value undefined :
Code:
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
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>alerte caracteres restants</title>
<script language="javascript">
function controle(chaine) {
var longueur=0;
longueur=chaine.length;
limite=10-longueur;
var message="Attention ! il ne voous reste que "+limite+" caractères disponibles";
if (limite<5 && limite>0) {
document.getElementById("alerte").style.visibility="visible";
document.getElementById("texte").className="fin";
document.getElementById("alerte").innerHTML=message;
}
else {
document.getElementById("alerte").style.visbility="hidden";
}
}
</script>
<style type="text/css">
.normal {
position:absolute;
left:64px;
top:83px;
height:25px;
width:329px;
visibility:hidden;
background-color:#FF0000;
border:1px solid double;
color: #FF0000;
padding:2px;
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
font-weight: bold;
}
.fin {
background-color:#FFFFCC;
color: #FF0000;
font-size:12px;
font-weight: bold;
}
</style>
</head>
<body>
<div id="alerte" class="normal"></div>
<form name="form1" method="post" action="">
<p>
<input name="texte" type="texte" id="texte" size="15" maxlength="15" onKeyUp="control(this.value);" />
</p>
</form>
</body>
</html> |
merci de vos réponses ;)