国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

javascript面向對象編程(一) 實例代碼

2019-11-21 00:24:50
字體:
來源:轉載
供稿:網友
復制代碼 代碼如下:

<script type="text/javascript">
var test = {
numA: 10,
objB: {},
arrC: [],
init: function(){
alert(this.numA);
},
sayHi: function(name){
alert("hello " + name);
},
sayHelloWorld: function(){
this.sayHi("world");
},
get: function(){
var self = this;
this.objB.alertNumA = function(){
alert(self.numA);
}
}
};
var TestFunc = function(){
alert("i'm testFunc");
};
TestFunc.prototype = {
extFunc: function(){
alert("this extend function's numB is " + this.numB);
},
numB: 10
};
test.init();
test.sayHi("qingming");
test.sayHelloWorld();
test.get();
test.objB.alertNumA();
var testFunc = new TestFunc();
testFunc.extFunc();
</script>
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 阿巴嘎旗| 景泰县| 紫阳县| 张家港市| 通城县| 沁水县| 冀州市| 姚安县| 方城县| 吉木乃县| 金塔县| 东明县| 吉木萨尔县| 阿巴嘎旗| 沛县| 黑河市| 安义县| 万年县| 临邑县| 三门县| 缙云县| 苗栗市| 东源县| 郑州市| 手机| 通渭县| 弥渡县| 平定县| 沧源| 吉安市| 平谷区| 胶州市| 抚松县| 即墨市| 福州市| 棋牌| 雷波县| 凤台县| 德阳市| 临汾市| 浮梁县|