李毅吧 关注:34,016,312贴子:993,655,460
  • 4回复贴,共1

你若安好,便是晴天!

只看楼主收藏回复

var People = function(status){
this.status = status;
};
People.prototype = {weather:false,getWeather:function(){alert(this.weather)},setWeather:function(p){this.weather = p}};
var you = new People('well'), i = new People();
if(you.status == 'well'){
i.setWeather('sunday');
}
i.getWeather();


IP属地:广东1楼2012-10-06 14:08回复
    如果爱,请深爱
    var People = function(status){
    this.status = status;
    };
    People.prototype = {
    weather:false,
    getWeather:function(){alert(this.weather)},
    setWeather:function(p){this.weather = p},
    love:function(){
    var lev = arguments[0];
    switch(lev){
    case 'deep': this.status = 'deepLove';break;
    case 'Shallow': this.status = 'shallowLove';break;
    default:this.status = 'love';
    }
    return this.status;
    }
    };
    var you = new People();
    if(you.love()){
    you.love('deep');
    }
    alert(you.status);


    IP属地:广东3楼2012-10-06 14:53
    回复
      var People = function(){};
      People.prototype = {
      isChinese:false,
      setTop:function(){
      this.isChinese = true;
      }
      };
      var people = new People();
      people.setTop();
      alert(people.isChinese);


      IP属地:广东6楼2012-10-06 15:05
      回复
        var People = function(name){this.name = name};
        People.prototype = {
        say:function(str){
        if(this.name == '二师兄'){
        alert('\u4E8C\u5E08\u5144,\u4F60\u5C31\u5C11\u8BF4\u4E24\u53E5\u5427!');
        return false;
        }
        alert(str);
        }
        };
        var people = new People('二师兄');
        people.say('师傅....');
        


        IP属地:广东7楼2012-10-06 15:22
        回复
          var Hand = function(){}
          Hand.prototype = {
          status:'warm',
          setStatus:function(param){this.status = param}
          };
          var People = function(sex){this.sex = sex};
          People.prototype = {
          hand:new Hand(),
          sleep:function(){if(this.sex == 'girl')this.hand.setStatus('cool')},
          walk:function(){if(this.sex == 'girl')this.hand.setStatus('cool')},
          run:function(){if(this.sex == 'girl')this.hand.setStatus('cool')},
          status:false,
          attack:function(p){p.setStatus('Injured')},
          setStatus:function(status){if(this.hand.status == 'cool'){alert('you can\'t attack she!'); return false};this.status = status;}
          };
          var boy = new People('boy'), girl = new People('girl');
          girl.walk();
          boy.attack(girl);


          IP属地:广东8楼2012-10-06 15:57
          回复