Hi all My first post.

I am developing a simple web page form where the visitor can input height and width and the script calculates the area and price.

The script below does this fine.

However, I would like to roundup the answer to the next integer for example if price = 45.678 final output would be 46.

I have tried Math.round(x) but the syntax totally defeats me.

I would be grateful if someone would give me a hand and post the required change to my script below.

Hopefully not a big ask.

Regards

-------------------------

<script type="text/javascript" language="Javascript">

var h1 = 0;
var w2 = 0;
var price = 0;

function calculate () {
// The Calculation: change operator in this equation to change the calculation
price = h1 * w2 * .0005;

var elem;
elem = document.getElementById("h1");
elem.value = h1;
elem = document.getElementById("w2");
elem.value = w2;

elem = document.getElementById("price");
elem.value = price;
}

function setValue(elem) {
var val = 0.0;
if (elem.value != "") {
val = parseFloat(elem.value);
}
else {
val = 0.0;
}
switch (elem.id) {
case "h1": h1 = val; break;
case "w2": w2 = val; break;
}
calculate();
}
</script>


--------------