소수점 반올림
페이지 정보
작성자 MintState 댓글 0건 조회 14,351회 작성일 08-11-17 11:36본문
소수점 반올림
ex) 3째자리에서 반올림
[COLOR="Navy"]Math.round(Test.value * 1000) / 1000;[/COLOR]
ex) 평수입력하면 ㎡로 변환 (소수점 2째 자리까지 구함)
ex) 3째자리에서 반올림
[COLOR="Navy"]Math.round(Test.value * 1000) / 1000;[/COLOR]
ex) 평수입력하면 ㎡로 변환 (소수점 2째 자리까지 구함)
<script>
function Square_check(_ea) {
var f = document.insert;
f.square2.value = Math.round(eval(_ea.value) * 3.3058 * 100) / 100;
}
</script>
<form method="post" name="insert" action="test.html" ENCTYPE="multipart/form-data">
<input type="text" name="square" value="<?=$data[square]?>" style="height:17; width:70;" onkeyup="Square_check(this)"> 평 =
<input type="text" name="square2" value="<?=sprintf("%01.2f",$data[square]*3.3058)?>" style="height:17; width:90;" readonly> ㎡ (<font color=red>미터법</font> 표기 ㎡ 로 환산됩니다.)
</form>|
|
댓글목록
등록된 댓글이 없습니다.





소수점 반올림