富贵资源网 Design By www.hznty.com
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>
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>
富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com
暂无评论...