`
xifan
  • 浏览: 2930 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

JS prototype

阅读更多
1.<script type="text/javascript">  
2.function employee(name,jobtitle,born)  
3.{  
4.this.name=name;  
5.this.jobtitle=jobtitle ;  
6.this.born=born;  
7.}  
8.var fred=new employee("Fred Flintstone","Caveman",1970);  
9.employee.prototype.salary=null;  
10.fred.salary=20000;  
11.document.write(fred.salary);  
12.</script>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics