<script >
function sum() {
var txtFirstNumberValue = document.getElementById('studentenrolled').value;
var txtSecondNumberValue = document.getElementById('classsize').value;
var result = parseInt(txtFirstNumberValue) / parseInt(txtSecondNumberValue);
if (!isNaN(result)) {
document.getElementById('nooftut').value = result;
}
}
</script>
<tr>
<td><label for="studentenrolled">Student Enrolled</label> </td>
<td> <input type="text" name="studentenrolled" id="studentenrolled" value="<?php echo $row['studentenrolled']; ?> " /></td>
</tr>
<tr>
<td><label for="classsize">Class Size</label> </td>
<td> <input type="text" id="classsize" onkeyup="sum();" /></td>
</tr>
<tr>
<td><label for="nooftut">No Of Tutorial</label> </td>
<td> <input type="text" id="nooftut" disabled="disabled" /></td>
</tr>
如何在“nooftut”计算中向上或向下舍入结果:studentenrolled / class size = nooftut 由于 studentenrolled 是从数据库中提取的,我无法向上或向下舍入
神不在的星期二
慕码人2483693
相关分类