Voici une excellente reponse du forum ALL HTML posté par alakazoo_:
Entre <BODY> et </BODY> :
<SCRIPT LANGUAGE=JavaScript>
monchiffre = -75.1598756421;
/* Le chiffre */
document.write('Mon chiffre : '+monchiffre+'<BR>');
/* arrondir */
document.write('Mon chiffre arrondi : '+ Math.round(monchiffre)+'<BR>');
/* valeur absolue */
document.write('Valeur absolue de mon chiffre : '+ Math.abs(monchiffre)+'<BR>');
/* arrondir a l'entier superieur */
document.write('Mon chiffre arrondi à l\'entier superieur : ' + Math.ceil(monchiffre)+'<BR>');
/* arrondir a l'entier inferieur */
document.write('Mon chiffre arrondi à l\'entier inferieur : ' + Math.floor(monchiffre)+'<BR>');
/* arrondir a deux chiffres apres la virgule, facon bidouille ;) */
document.write('Mon chiffre arrondi à deux chiffres : ' + (Math.round(monchiffre*100))/100+'<BR>');
</SCRIPT>
Exemple:
Mon chiffre : -75.1598756421
Mon chiffre arrondi : -75
Valeur absolue de mon chiffre : 75.1598756421
Mon chiffre arrondi à l'entier superieur : -75
Mon chiffre arrondi à l'entier inferieur : -76
Mon chiffre arrondi à deux chiffres : -75.16
-------------------------------------
alakazoo_
-------------------------------------
-= Bobinours =-