我有一个js代码如下,
function findDealerByIdResponse() {
findDealerByIdResponse.prototype = findDealerByIdResponseType;
this.getPrefix = function(){
return "tns1";
};
this.getNS = function(){
return "http://www.hp.com/bookservice";
};
}
function findDealerByIdResponseType(){
var DEALER ;
this.getPrefix = function(){
return "tns1";
};
this.getNS = function(){
return "http://www.hp.com/bookservice";
};
}
function getName( obj ) {
var funcNameRegex = /function (.{1,})\(/;
var results = new Object();
results = (funcNameRegex).exec((obj).constructor.toString());
return (results && results.length > 1) ? results[1] : "";
};
function test(){
var req = new findDealerByIdResponse();
alert(getName(req));
}
但是,如果我第一次执行“测试”,它会给出我所期望的:“doTransactionType”。但之后它给出了 "Function" 。请说明原因。
谢谢
迪帕克