-1
空我有一个类在JS与现场Javascript类成员变成在Firefox
Widget = function()
{
this.Attributes = []; // key=value
}
和从Widget
BusinessStatisticWidget = function()
{
// some code
};
BusinessStatisticWidget.prototype = new Widget();
iherited另一类在初始化阶段,我已经分配了该属性字段具有值(只有一次),并在某个点Atttibutes字段变为空:
BusinessStatisticWidget.prototype.SetEventsOnControls = function()
{
var dropDown = document.getElementById(this.DropDownName + this.type + "Id");
var _this = this; // **Not empty here**
dropDown.addEventListener("change", function (event)
{
// **Not empty even here**
_this.CalculateAndSetTimeRangeForTimeSpan(event.target.value);
}, false);
}
BusinessStatisticWidget.prototype.CalculateAndSetTimeRangeForTimeSpan = function (val)
{
// **Empty here**
if (this.Attributes["fromDate"].value != '' && this.Attributes["toDate"].value != '')
{}
}
上面的代码在Chrome和IE10(我的意思是数组不为空)的罚款,但在Firefox不工作(20.0.1)
由于数组是空的,我得到TypeError: this.Attributes.fromDate is undefined.
,我不知道为什么它是空的,如何解决这个问题。
TypeError:this.Attributes.fromDate未定义。就像我说的 - 这个。属性是空的,我不知道为什么以及如何解决这个问题 – 2013-04-30 12:10:49
你的代码中缺少几个右花括号。 – 2013-04-30 12:12:28