js方法类库封装的简易示例

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
//用这种方法和原理可以封装jquery的方法类库
if (typeof mss == "undefined" || !mss) {
    var mss = {};
}

mss = {
test1 : function(){ console.log('test1');},
test2 : function(){ console.log('test2');},
test3 : function(){ console.log('test3');}
};
mss.test1();
</script>

posted @ 2014-02-17 15:49  jami918  阅读(392)  评论(0编辑  收藏  举报