如:
在不使用属性赋值类名的使用下
function treeSearch(){
this.name="rang";
//不允许使用this.className='treeSearch';的情况下
}
treeSearch.property={
getClassName:function(){
//我在这里怎么获取到treeSearch的名称,并返回 }
};
求解决方案....
解决方案 »
- ie8下window.open问题
- js重定向
- JQUERY插件,简单问题,请教
- 这段窗口关闭代码,为什么窗口没有关闭,而是点击链接到其它页面时,也执行了此代码,为什么
- window.onload=function()这个方法在一个页面中不能出现多次?
- 一个关于图片滚动的问题~ 既能左右滚,又能上下滚动
- 请教这个问题怎么解决
- prototype.js的源文件中,经常出现iterator,我不太理解,请达人明示?
- 求发一个手机网站用的轮播图,轮播的图可以随屏幕大小改变的。谢谢
- 关于转义字符的替换
- HighChart做的曲线,提示框内容能否加入除x\y以外的内容?
- 急!jquery获取某行某列的问题
你的问题应该是要获取类的引用而不是名称,具体怎么做要看实际情况
this.name="rang";
}
treeSearch.prototype={
getClassName:function(){
console.log(this.constructor.name);
}
};
treeSearch.prototype.constructor = treeSearch;
var abc = new treeSearch();
abc.getClassName();
我在ie下测试,提示undefined....
感谢,可以了,我把this.constructor.name改为
this.constructor.toString(),然后再截取字符串,获取名称就可以...
感谢,可以了,我把this.constructor.name改为
this.constructor.toString(),然后再截取字符串,获取名称就可以...
这样也可以,还有个更恶心的办法
for(var i in window){
if(window[i]==this.constructor){
alert(i);
}
}
万恶的IE
感谢,可以了,我把this.constructor.name改为
this.constructor.toString(),然后再截取字符串,获取名称就可以...
这样也可以,还有个更恶心的办法
for(var i in window){
if(window[i]==this.constructor){
alert(i);
}
}
万恶的IE
果然万恶啊,真的可以.....