try with this function: <script> function round(x,n){ eval("y=10E"+(n-1)) return Math.round(x*y)/y } do***ent.write(round(1/3,2)) </script>