<!-- ROUND TO NUMBER --> <!-- This goes in the HEAD of the html file --> <script language="JavaScript" type="text/javascript"> <!-- Copyright 2005, Sandeep Gangadharan --> <!-- For more free scripts go to http://sivamdesign.com/scripts/ --> <!-- function getRound() { num = window.prompt("Please type in the number of decimals to round the number to.",""); if (num == "null" || num == "") return; num1 = Math.pow(10, num); result = Math.round(document.form1.theNum.value * num1) / num1; document.form1.theNum.value = result; } // --> </script> <!-- This goes into the BODY of the file --> <form name="form1"> <input type="text" name="theNum" /> <input type="button" value="Round to..." onClick="getRound()" /> </form> </div>