私はいくつかのプロパティとメソッドを定義し、配列を作成し、クラスのインスタンス値を作成してプッシュしました。その後、配列を反復し、特定のメソッドからプロパティをチェックしましたが、IE と mozilla では未定義として表示されます。詳細については、コードを以下に示します。
クラス:
function DateDetail(date, isBefore, isAfter, isNow) {
this.Date = date;
this.MonthNo = this.Date.getMonth();
this.DayNo = this.Date.getDate();
this.Year = this.Date.getFullYear();
this.IsAfter = isAfter;
this.IsBefore = isBefore;
this.IsNow = isNow;
this.GetMonthValue = function () {
return this.Date.toString("MMM-yyyy");
};
}
方法
function GetTableDataClass(data) {
if (data.IsAfter)
return "after";
else if (data.IsBefore)
return "before";
else if (data.IsNow)
return "now";
else
return " ";
}
呼び出し方法
GetTableDataClass(item)
mozilla と IE でデータが定義されていません。提案があれば教えてください。