guanxf

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

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

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          bolg

          搜索

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          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 管先飛 閱讀(1275) 評(píng)論(1)  編輯  收藏

          評(píng)論

          # re: js封裝屬性和方法 2014-11-10 11:23 21
          213312  回復(fù)  更多評(píng)論
            


          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 玛曲县| 黄石市| 江口县| 武强县| 卢龙县| 贵南县| 屯留县| 兴安县| 宜宾市| 宁武县| 金湖县| 池州市| 富源县| 盐津县| 珠海市| 洛南县| 山东| 崇礼县| 浙江省| 保德县| 历史| 遵义市| 古丈县| 福安市| 太原市| 老河口市| 卢湾区| 大宁县| 桂东县| 华亭县| 云阳县| 涞源县| 漯河市| 宜宾市| 中西区| 卢氏县| 县级市| 河北省| 朔州市| 苏尼特右旗| 兖州市|