java类的功能了 如何调用
研究深入javascript发现搞精通绝对不容易
var come= new Class({
initialize: function(){
this.integerParameter=-1;
this.integerParameter2=-1;
this.integerParameter3=-1;
this.doubleParameter=-1.0;
this.doubleParameter2=-1.0;
}
});
看看这个类 , 如何条用这个类??
在看看var Util = new Class({
initialize: function(){
this.dateRegex=/(\d{1,4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):.+/;
},
getDateFromJavaString: function(dateString){
var rezDate=new Date();
var rez=dateString.match(this.dateRegex);
rezDate.setYear(rez[1]);
rezDate.setDate(parseFloat(rez[3]));
rezDate.setMonth(parseFloat(rez[2])-1);
rezDate.setHours(parseFloat(rez[4]));
rezDate.setMinutes(parseFloat(rez[5]));
return rezDate;
}
});
var util = new Util();------这个简直就是java类的功能了 如何调用?
下面代码里 有很多问题
1 Dis extend哪一个类?
2 initialize是社么含义
2 Element代表什么意思 ? 全部代码表示什么意思?
var Dis = CategElement.extend ({
initialize: function(id){
this.parent(id);
this.countries=new Hash();
//this.setClassName('MarketTab');
/*var headerRow=new Element('tr',{'class': 'headerRow'});
var dateCell=new Element('td',{'class': 'dateWidth'});
dateCell.setText('DATE');
dateCell.injectInside(headerRow);
var hourCell=new Element('td',{'class': 'hourWidth'});
hourCell.setText('HOUR');
hourCell.injectInside(headerRow);
var homeTeamCell=new Element('td',{'class': 'teamWidth'});
homeTeamCell.setText('HOME-TEAM');
homeTeamCell.injectInside(headerRow);
var awayTeamCell=new Element('td',{'class': 'teamWidth'});
awayTeamCell.setText('AWAY-TEAM');
awayTeamCell.injectInside(headerRow);
var homeCell=new Element('td',{'width': '45','colspan': '2'});
homeCell.setText('HOME');
homeCell.injectInside(headerRow);
var drawCell=new Element('td',{'width': '45','colspan': '2'});
drawCell.setText('DRAW');
drawCell.injectInside(headerRow);
var awayCell=new Element('td',{'width': '45','colspan': '2'});
awayCell.setText('AWAY');
awayCell.injectInside(headerRow);
var expandCell=new Element('td',{'width': '10'});
expandCell.setHTML(' ');
expandCell.injectInside(headerRow);
//headerRow.injectInside(this.topElement);*/
this.elementLine=new Element('tr',{'class': 'titleLine'});
this.elementCell=new Element('td');
this.elementLine.injectInside(topTableBody);
},
addCountry: function(country){
this.countries.set(country.id,country);
this.appendCategChildRow(country);//,'SubMarket'
},