zoukankan      html  css  js  c++  java
  • jquery函数写法

    普通jquery函数写法

    <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
    <script type="text/javascript">
    $(function(){
        var myfunc = {
            aaa: 0,
            init:function(aaa) {
                this.aaa=aaa;
            },
            log:function(msg) {
                if(  (EpBrowser.core=="chrome")  ){//chrome
                    console.log("log>>    "+msg);
                }
            }
        };
        myfunc.init("ddddddddd");
        alert(myfunc.aaa);
    });
    </script>

    (不确定的参数,初始化及传参)有亮点!!

    <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
    <script type="text/javascript">
    $(function(){
        var Person={
            init : function(option){
                if(typeof option == "undefined"){
                    option = {};
                }
                this.aaa = option.aaa || "啊啊啊";
                this.bbb = option.bbb || 25;
                this.ccc = option.ccc || 75;
                this.ddd = (typeof option.ddd != "undefined") ? option.ddd : true;
            },
            showInfo : function(){
                return this.aaa + " " + this.bbb + " " + this.ccc + " " + this.ddd;
            }
        }
        Person.init({
            ccc : 80,
            ddd : "Hank"
        })
        alert(Person.showInfo()); //啊啊啊 25 80 Hank
    });
    </script>
  • 相关阅读:
    别了,DjVu!
    DjVu转PDF
    我的电子书历程
    连续翻页浏览器面临的共同问题
    对超过2TB的硬盘进行分区需要使用parted
    DB2常用命令
    CentOS增加网卡
    mysql相关参数解读
    max_user_connections参数设置试验
    mysql最大连接数试验
  • 原文地址:https://www.cnblogs.com/qq21270/p/3992430.html
Copyright © 2011-2022 走看看