<html>
<head>
<script type="text/javascript">

function People(name){
var isSingle = 'youl';//构造函数的私有属性
this.name = name;//公共属性
var queryIsSingle = function(sex){
  if (sex == '1'){
    return true;  
  }
  else if(sex == '2'){
    return false;
  }
}//私有方法
 
this.getIsSingle = function(sex){
    return queryIsSingle() ? 'boy' : 'gril'; 
}//公共方法

}

var p = new People('susan');
document.write(p.name);

People.prototype.age = 10;//原形属性
People.prototype.sayHi = function(){
  return 'Hello ' + this.name;
};//原形方法
 
var sayStr = p.sayHi();
alert(sayStr);
document.write(p.age);


People.make = function(tool){
  if ('' == tool){
    document.write('');
  }
  else if ('' == tool){
    document.write('戒指');
  }
}//静态方法

People.make('');

</script>
</head>
<body>
  
</body>
</html>

 

posted on 2014-05-19 10:25  苏荷酒吧  阅读(137)  评论(0)    收藏  举报