I'm new to Javascript but am trying to create a script to take a diameter, display only 3 decimal places and round the third decimal place to the nearest 5. I found some code which I think will do what I need to do here but can't work out how to add it to my existing code. I've added the third field as a check to make sure the result has been "rounded" correctly, can anyone point me in the right direction?
function calculate() {
var circBox = document.getElementById('circ').value;
var diameterBox = document.getElementById('diameter');
var diameterBox2 = document.getElementById('diameter2');
var Diameter = circBox / 3.1416;
var Diameter2 = Diameter.toFixed(5);
var Diameter3 = Math.ceil(Diameter2 * 1000) / 1000;
diameterBox.value = Diameter3;
diameterBox2.value = Diameter2;
}