码迷,mamicode.com
首页 > 编程语言 > 详细

有关javascript 里的Math的使用.

时间:2014-07-30 03:28:24      阅读:352      评论:0      收藏:0      [点我收藏+]

标签:javascript   web   function   

<!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")
是获取值里的对象.

有关javascript 里的Math的使用.,布布扣,bubuko.com

有关javascript 里的Math的使用.

标签:javascript   web   function   

原文地址:http://dsktt.blog.51cto.com/2811323/1532486

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!