zoukankan      html  css  js  c++  java
  • arguments的简单用法

    <script type="text/javascript">
            //Js中的函数可以不显式定义参数,arguments就是参数集合,在调用函数是传入了几个参数,
            //arguments集合就包含所有的传入参数,且参数顺序和传入顺序一致
            //js中的函数不需要显式的声明返回值
            function showHe() {
                //alert(arguments[0]+arguments[1]+arguments[2]);
               return arguments[0] + arguments[1] + arguments[2];
            }
            function getshowhe() {
                var he = showHe(4, 5, 6);
                alert(he);
            }
        </script>
    </head>
    <body>
    <input type="button" value="click me" onclick="showHe(4,5,7)" />
    <input type="button" value="调用showHe函数" onclick="getshowhe()" />
    </body>
    </html>

  • 相关阅读:
    css 基础
    css 基础-1
    html 入门2-表
    CMDB (后台管理) CURD 插件
    序列化
    AES(高级加密)
    API验证
    数据库取时间(分组)
    用户权限 (知识点)
    xss 过滤
  • 原文地址:https://www.cnblogs.com/duanlinlin/p/3010617.html
Copyright © 2011-2022 走看看