87,996
社区成员




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>计算器</title>
<script type="text/javascript">
function start(a)
{
var shuju=document.getElementById("shuju").value;
var num1;
switch(a){
case 1:
num1=Math.round(shuju);
break;
default:
alert("wu");
}
document.getElementById("show").value=num1;
}
function a(){
alert("你好!");
}
</script>
</head>
<body>
原始数据输入:<input type="text" id="shuju"></input><br/>
<button onclick="start(1)">取整(四舍五入)</button>
<input type="button" value="取整(四舍五入)" onclick="start(1)"></input><br/>
运算结果:<input type="text" id="show"></input>
</body>
</html>
<input type="button" value="取整(四舍五入)" onclick="window.start(1)"></input>