

<!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>Untitled Page</title>
<script type="text/javascript">
///计算三角函数的的
function resule() {
var longBorder = new Number(document.getElementById("longBorder").value);
var shortBorder = new Number(document.getElementById("shortBorder").value);
var resuleConValue = new Number();
resuleConValue = Math.atan2(shortBorder, longBorder);
angle = resuleConValue * (180 / Math.PI);
document.getElementById("resultCon").value = angle
}
</script>
</head>
<body>
<p>
长边:<input type="text" id="longBorder" />
</p>
<p>
短边:<input type="text" id="shortBorder" />
</p>
<p>
结果:<input type="text" id="resultCon" />
</p>
<input type="button" value="计算" onclick="resule();" />
</body>
</html>
document.getElementById("longBorder").value
才是获取文本框里面的值..
而document.getElementById("longBorder")
是获取值里的对象.