第一个js库文件

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>js lever</title>

<script type="text/javascript">
    var testModult =(function(){
        var counter = 0;
        return {
                    incrementCounter:function()
                    {
                        return ++counter;
                    },
                    resetCounter:function(){
                        console.log("counter value prior to reset: "+counter);
                        counter=0;
                    }
                };
    })();
    testModult.incrementCounter();
        testModult.resetCounter();
</script>
</head>
<body>
</body>
</html>
posted @ 2013-09-27 16:53  Seaurl  阅读(315)  评论(0编辑  收藏  举报