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
|
<html>
<head>
<title></title>
<style type="text/css">
<!--
#divMoins{
background-color: #00AA00;
width: 0px;
display: none;
height: 50px;
border: none;
margin: 0px;
padding: 0px;
float: left;
}
#divPlus{
background-color: #FF0000;
width: 120px;
height: 50px;
border: none;
margin: 0px;
padding: 0px;
float: left;
}
.CRLF{
clear: both;
visibility: hidden;
}
//-->
</style>
<script type="text/javascript">
<!--
function plus(n)
{
var elM = document.getElementById("divMoins");
var elP = document.getElementById("divPlus");
if (elM.style.display!="block")
elM.style.display="block";
if (elP.style.display!="block")
elP.style.display="block"
elM.style.width = Math.round(120-n*120/100); //120 : largeur du div
elP.style.width = Math.round(n*120/100);
if (n==100)
elM.style.display="none";
if (n==0)
elP.style.display="none";
}
//-->
</script>
</head>
<body>
<table border="1" width="140px">
<tr>
<td>
<div id="divPlus">
</div>
<div id="divMoins">
</div>
</td>
</tr>
</table>
<hr class="CRLF">
Entrez une valeur :
<input type="text" id="idN" name="" maxlength="10">%<br>
<input type="button" style="width: 50px" value="test" onclick="plus(document.getElementById('idN').value)"><br><br>
</body>
</html> |