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

首頁 > 編程 > JavaScript > 正文

In Javascript Class, how to call the prototype method.(three method)

2019-11-21 02:21:31
字體:
來源:轉載
供稿:網友
1、Using Javascript eval Method。
2、using a veriables save object "this" reference.
3、in innerHTML, we can using String to pass the prototype Method。

e.g.

<SCRIPT LANGUAGE="JavaScript">
<!--
function myClass(instanceName)
{
 this.instanceName = instanceName;
 this.instance = this;
 return this;
};
myClass.prototype.toAlert=function()
{
 eval(this.instanceName).callback(); // the first method to call prototype function.
 this.instance.callback(); // the second method to call prototype function.

 // the third method to call prototype function.
 document.write("<a href='javascript:void(0);' onclick='" + this.instanceName + ".callback();'>instance call prototype function.</a>")
};
myClass.prototype.callback=function()
{
 alert("blueDestiny, never-online");
};
var a = new myClass("a");
a.toAlert();
//-->
</SCRIPT>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 且末县| 崇义县| 玉门市| 余庆县| 郴州市| 灵丘县| 澄城县| 鸡东县| 吉安市| 广德县| 溧水县| 化德县| 磐石市| 金昌市| 桃江县| 怀来县| 新郑市| 楚雄市| 成都市| 宿松县| 梅州市| 蒙自县| 新绛县| 光泽县| 响水县| 双江| 民县| 白河县| 富源县| 清远市| 呼和浩特市| 华蓥市| 胶州市| 阿坝| 罗定市| 岗巴县| 乌苏市| 彰化市| 繁峙县| 图木舒克市| 会泽县|