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
| <html>
<head>
<title>Nouvelle page 1</title>
<script type="text/javascript">
function fait(quoi,ajout){
var value=+document.getElementById('res').innerHTML;
dec=0
if(ajout.toString().indexOf('.')>-1){
dec=ajout.toString().split('.')[1].length;
}
switch (quoi){
case '+': value=Math.round((value+ajout)*Math.pow(10,dec),0)/Math.pow(10,dec);
break;
case '-': value=(value>0)?Math.round((value-ajout)*Math.pow(10,dec),0)/Math.pow(10,dec):value;
break;
}
document.getElementById('res').innerHTML=value;
}
</script>
<style type='text/css'>
a:link {text-decoration:none;}
a:visited {text-decoration:none;}
</style>
</head>
<body>
<div id="res">0</div><a href="#" onclick="fait('+',0.01)">+</a> <a href="#" onclick="fait('-',0.01)">-</a>
</body> |
Partager