构造函数案例
来源:互联网 发布:mysql date add 1 day 编辑:程序博客网 时间:2024/06/01 20:13
//构造函数/也叫对象模板
function Student(){
this.sname=sname;
this.sage=sage;
this.intrSelf=function(){
dialog.innerHTML="I'm "+this.sname+"+,I'm "+this.sage;
dialog.style.display="block";
}
}
//Step2:用new调用构造函数,传入属性值
var lilei=new Student("Li Lei",18);
var hmm=new Student("Han Meimei",19);
function Student(){
this.sname=sname;
this.sage=sage;
this.intrSelf=function(){
dialog.innerHTML="I'm "+this.sname+"+,I'm "+this.sage;
dialog.style.display="block";
}
}
//Step2:用new调用构造函数,传入属性值
var lilei=new Student("Li Lei",18);
var hmm=new Student("Han Meimei",19);
0 0
- 构造函数案例
- 1.2 案例:利用构造函数创建表格 table
- C#之用Base方法调用基类构造函数学习案例
- 关于引用构造函数形参和实际参数的数据类型必须一致的实验案例
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- POJ 2449-Remmarguts' Date(A*+spfa)
- HDU 2489 Minimal Ratio Tree(dfs+最小生成树)
- ping命令整个过程详解
- 226. Invert Binary Tree
- Markdown基础语法
- 构造函数案例
- Fragment 生命周期
- Qt Creator 窗体控件自适应窗口大小布局
- Java基础05-循环问题,数组
- 独占式互斥量
- 图像检索之product quantization 算法解析
- 雪碧图以及冒泡
- 从 startActivity 看activity启动流程
- python笔记