Math.ceil(number)
Let us try with some examples.
document.write (Math.ceil(11.257)); // output 12
document.write ("<br>----<br>");
document.write (Math.ceil(1.56)); // output 2
document.write ("<br>----<br>");
document.write (Math.ceil(-3.564)); // output -3
document.write ("<br>----<br>");
document.write (Math.ceil(-7.164)); // output -7
document.write ("<br>----<br>");
document.write(Math.ceil()); // Output NaN
document.write("<br>");
document.write(Math.ceil('xyz')); // Output NaN
document.write("<br>");
<script>
document.write(Math.round(5.67)+'<br>'); // Output 6
document.write(Math.ceil(5.67)+'<br>'); // Output 6
document.write(Math.round(5.42)+'<br>'); // Output 5
document.write(Math.ceil(5.42)+'<br>'); // Output 6
document.write(Math.round(-5.67)+'<br>'); // Output -6
document.write(Math.ceil(-5.67)+'<br>'); // Output -5
document.write(Math.round(-5.42)+'<br>'); // Output -5
document.write(Math.ceil(-5.42)+'<br>'); // Output -5
</script>
Here is the code
echo "<script type="text/javascript">
function disp_data(){
var a1 = document.getElementById('t1').value;
a1=Math.ceil(a1);
document.getElementById("a2").innerHTML= a1;
}
</script>
<input type=text name=t1 id='t1' value=-12.78><input type=button value='Display Ceil value' onClick='disp_data()';>
<div id='a2' style=" background-color: #c0f0c0; width:200" > Enter a number</div>";
You can read the php math ceil function