guanxf

          我的博客:http://blog.sina.com.cn/17learning

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            71 隨筆 :: 1 文章 :: 41 評論 :: 0 Trackbacks
          <2011年12月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          bolg

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          function Person(){
            var  age=0;//定義私有成員變量age
            function checkAge(age){
               if(age<0 && age>150){
                   return false;
               }
               return true;
            }
          this.setAge=function(theAge){
            if(checkAge(theAge)){
               age=theAge;    
            }else{
               alert("please input cuerrent age!");
            }
          }
          this.getAge=function(){
               document.write(age);
               return age;
          }
          }
          var per=new Person();
          per.setAge(122);
          per.getAge();
          posted on 2011-12-15 00:56 管先飛 閱讀(1273) 評論(1)  編輯  收藏

          評論

          # re: js封裝屬性和方法 2014-11-10 11:23 21
          213312  回復  更多評論
            


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 贞丰县| 乌鲁木齐市| 沙雅县| 依兰县| 崇信县| 巢湖市| 博兴县| 曲靖市| 观塘区| 宜黄县| 祁东县| 惠来县| 绥阳县| 泸定县| 闽清县| 九寨沟县| 梧州市| 射阳县| 东城区| 乌苏市| 天等县| 宁津县| 鲜城| 安仁县| 怀柔区| 广水市| 舒城县| 阳春市| 无极县| 桓台县| 佛冈县| 绥阳县| 沙河市| 克什克腾旗| 湄潭县| 黔江区| 县级市| 靖边县| 合作市| 西吉县| 丰原市|