zoukankan      html  css  js  c++  java
  • JS对象的使用

    <!DOCTYPE html>
    <html>
    <head lang="en">
        <meta charset="UTF-8">
        <title>JS对象使用</title>
        <script type="text/javascript">
            //Date使用
            var date = new Date();//当前系统时间
            //获取年月日等
            document.write(date.toLocaleString()+"<br/>");
            document.write(date.getFullYear()+"<br/>");
            document.write(date.getDate()+"<br/>");
            document.write(date.getDay()+"<br/>");
            document.write(date.getMonth()+1+"<br/>");
            //有get,对应的就有set  设置各个值
            date.setFullYear(date.getFullYear()+1);
            document.write(date.getFullYear()+"<br/>");
    
            //Math使用
            document.write(Math.abs(-3.5)+"<br/>");//绝对值
            document.write(Math.ceil(-3.5)+"<br/>");//-3 向上取整
            document.write(Math.floor(-3.5)+"<br/>");//-4 向下取整
            document.write(Math.max(-3,9)+"<br/>");//9最大值
            document.write(Math.round(4.6)+"<br/>");//6  四舍五入
    
        </script>
    </head>
    <body>
    
    </body>
    </html>
    

      

  • 相关阅读:
    构建之法
    第一阶段SCRUM冲刺
    NABCD项目分析
    结对开发
    梦断代码阅读-04
    梦断代码阅读-05
    移动端疫情展示
    用Python爬取疫情数据
    全球疫情可视化地图
    第二阶段冲刺第三天个人记录
  • 原文地址:https://www.cnblogs.com/john568300/p/6411162.html
Copyright © 2011-2022 走看看