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

首頁(yè) > 開(kāi)發(fā) > JS > 正文

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

2024-09-06 12:43:55
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
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>
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 长岭县| 铜川市| 高雄市| 甘德县| 临猗县| 罗城| 金华市| 大兴区| 枣阳市| 通化市| 拉孜县| 霍城县| 桐城市| 贵港市| 大足县| 旺苍县| 鹤峰县| 柘荣县| 汝南县| 治县。| 曲水县| 清远市| 蓬莱市| 镇坪县| 宁河县| 三门峡市| 西乌| 江都市| 通江县| 乌兰察布市| 江油市| 宝丰县| 洞口县| 宝应县| 富蕴县| 泰来县| 亚东县| 栾城县| 麦盖提县| 崇阳县| 宾阳县|