国产探花免费观看_亚洲丰满少妇自慰呻吟_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>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 张家界市| 凭祥市| 忻城县| 河津市| 米泉市| 永靖县| 永福县| 青冈县| 华宁县| 福清市| 长宁区| 山阳县| 额尔古纳市| 小金县| 资阳市| 沧源| 石首市| 乌苏市| 页游| 海口市| 邛崃市| 巍山| 崇左市| 应城市| 贵德县| 自贡市| 庄浪县| 陇西县| 封开县| 浪卡子县| 仙桃市| 屏山县| 宁武县| 满洲里市| 上蔡县| 盐城市| 乐业县| 石林| 舞阳县| 崇礼县| 桓仁|