All pastes #478014 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-05-08 23:21 UTC
rendered paste body
<html>
<head><title>some</title>
<script language="javascript" type="text/javascript">
function check(){
	var src, arr;
	src = document.getElementById("frac-to-dec").value;
	arr = src.split("/");
	if(arr.length < 2){
		document.getElementById("dec-result").value = src;
	}else{
		if(!(isNaN(arr[0]) || isNaN(arr[1]))){
			document.getElementById("dec-result").value = Math.round((arr[0] / arr[1])*1000000)/1000000;
		}else{
			document.getElementById("dec-result").value = "Bad Input!";
		}
	}
}
</script>
</head>
<body>
<input id="frac-to-dec" type="text" size="11">
<input id="dec-result" type="text" size="11" style="color: #444" disabled>
<input type="button" value="Calculate" onclick="check()">
</html>