zoukankan      html  css  js  c++  java
  • 2020/12/14

    <body>
    
    <p id="demo">单击按钮舍入与“2.5”最接近的整数</p>
    <button onclick="myFunction()">点击</button>
    <script>
    function myFunction(){
    	document.getElementById("demo").innerHTML=Math.round(2.5);
    }
    
    <body>
    
    <p id="demo">点击按钮显示一个随机数</p>
    <button onclick="myFunction()">点击</button>
    <script>
    function myFunction(){
    	document.getElementById("demo").innerHTML=Math.random();
    }
    </script>
    
    </body>
    
    <body>
    
    <p id="demo">单击按钮返回5到10之间的最大值。</p>
    <button onclick="myFunction()">点击</button>
    <script>
    function myFunction(){
    	document.getElementById("demo").innerHTML=Math.max(5,10);
    }
    </script>
    
    </body>
    
    <body>
    
    <p id="demo">单击按钮返回5到10之间最小的值。</p>
    <button onclick="myFunction()">点击</button>
    <script>
    function myFunction(){
    	document.getElementById("demo").innerHTML=Math.min(5,10);
    }
    </script>
    
    </body>
    

     二.几个数学的script语句

  • 相关阅读:
    github添加ssh
    包围盒的计算以及物体移动到世界坐标中心
    123
    mysql
    建站步骤
    深度遍历和广度遍历
    Js特殊字符转义之htmlEscape()方法
    参数命名风格转换
    http 206
    js 实现快速排序
  • 原文地址:https://www.cnblogs.com/qiangini/p/14162337.html
Copyright © 2011-2022 走看看