国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 平利县| 罗田县| 仁寿县| 历史| 馆陶县| 康平县| 富宁县| 全椒县| 三原县| 安远县| 成安县| 离岛区| 武强县| 化德县| 泸定县| 固始县| 双鸭山市| 高邑县| 镇康县| 亳州市| 理塘县| 芮城县| 江口县| 彭水| 淮滨县| 华蓥市| 甘泉县| 延寿县| 宜章县| 沐川县| 泾阳县| 定陶县| 延长县| 灌阳县| 尉氏县| 陆良县| 教育| 南宫市| 凌海市| 烟台市| 从化市|